From d6d9eb864ca426214bb7613c62cf8e1a9491a450 Mon Sep 17 00:00:00 2001 From: jugglinmike Date: Thu, 18 Apr 2019 07:52:06 -0400 Subject: [PATCH] XHR: readystatechange can dispatch multiple times during LOADING --- xhr/send-redirect-post-upload.htm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xhr/send-redirect-post-upload.htm b/xhr/send-redirect-post-upload.htm index 5c1c6387adb78a..b1db8ec2ac942e 100644 --- a/xhr/send-redirect-post-upload.htm +++ b/xhr/send-redirect-post-upload.htm @@ -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)