Skip to content

Commit

Permalink
XHR: readystatechange can dispatch multiple times during LOADING
Browse files Browse the repository at this point in the history
  • Loading branch information
jugglinmike authored and annevk committed Apr 18, 2019
1 parent efdf64c commit d6d9eb8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions xhr/send-redirect-post-upload.htm
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@
if(xhr.readyState >= xhr.HEADERS_RECEIVED) {
assert_equals(xhr.status, 200, "JS never gets to see the 30x status code");
}

// The UA may fire multiple "readystatechange" events while in
// the "loading" state.
// https://xhr.spec.whatwg.org/#the-send()-method
if (xhr.readyState === 3 && actual[actual.length - 1] === "xhr onreadystatechange 3") {
return;
}

actual.push("xhr onreadystatechange " + xhr.readyState);
});
xhr.onload = test.step_func(function(e)
Expand Down

0 comments on commit d6d9eb8

Please sign in to comment.