Skip to content

Commit 4c41b4e

Browse files
MayyaSunilmoz-wptsync-bot
authored andcommitted
add immutable guard for fetch response headers.
Differential Revision: https://phabricator.services.mozilla.com/D162209 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1574174 gecko-commit: fcb447986ee1be3457e44c8b43167a193788f48e gecko-reviewers: edenchuang, necko-reviewers
1 parent 26706d3 commit 4c41b4e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

fetch/api/response/response-static-error.any.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ test(function() {
1111
assert_true(responseError.headers.entries().next().done, "Headers should be empty");
1212
}, "Check response returned by static method error()");
1313

14+
promise_test (async function() {
15+
let response = await fetch("../resources/data.json");
16+
17+
try {
18+
response.headers.append('name', 'value');
19+
} catch (e) {
20+
assert_equals(e.constructor.name, "TypeError");
21+
}
22+
23+
assert_not_equals(response.headers.get("name"), "value", "response headers should be immutable");
24+
}, "Ensure response headers are immutable");
25+
1426
test(function() {
1527
const headers = Response.error().headers;
1628

0 commit comments

Comments
 (0)