Skip to content

Commit

Permalink
XHR: overrideMimeType() is not reset by open()
Browse files Browse the repository at this point in the history
Also fix the number of replacement characters.

See also #12289.
  • Loading branch information
annevk committed Oct 1, 2018
1 parent e5dcf1a commit 25ddc4a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions xhr/overridemimetype-edge-cases.window.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
const testURL = "resources/status.py?type=" + encodeURIComponent("text/plain;charset=windows-1252") + "&content=%C2%F0";

async_test(t => {
const client = new XMLHttpRequest();
client.onload = t.step_func_done(() => {
assert_equals(client.responseText, "\uFFFD\uFFFD");
});
client.overrideMimeType("text/plain;charset=UTF-8");
client.open("GET", testURL);
client.send();
}, "overrideMimeType() is not reset by open(), basic");

async_test(t => {
const client = new XMLHttpRequest();
let secondTime = false;
Expand All @@ -10,14 +20,14 @@ async_test(t => {
client.open("GET", testURL);
client.send();
} else {
assert_equals(client.responseText, "Âð");
assert_equals(client.responseText, "\uFFFD\uFFFD");
t.done();
}
});
client.open("GET", testURL);
client.overrideMimeType("text/plain;charset=UTF-8")
client.send();
}, "overrideMimeType() state needs to be reset across requests");
}, "overrideMimeType() is not reset by open()");

async_test(t => {
const client = new XMLHttpRequest();
Expand Down

0 comments on commit 25ddc4a

Please sign in to comment.