Bug 1508377 - properly update XHR status when one is aborted because of an NS_BINDING_ABORTED confition such as window.stop(); r=baku
authorThomas Wisniewski <twisniewski@mozilla.com>
Mon, 11 Mar 2019 13:30:38 +0000
changeset 524380 9c46b805faebe42a7abc0a84fe5f35bacbb8970a
parent 524379 b761a7b69ababcd91034dbbe1410bd1089f4925f
child 524381 e37e74e923b9bfb27f9330450e89395865fe5087
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1508377
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1508377 - properly update XHR status when one is aborted because of an NS_BINDING_ABORTED confition such as window.stop(); r=baku properly update XHR status when one is aborted because of an NS_BINDING_ABORTED confition such as window.stop() Differential Revision: https://phabricator.services.mozilla.com/D22852
dom/xhr/XMLHttpRequestMainThread.cpp
testing/web-platform/tests/xhr/abort-after-stop.htm
--- a/dom/xhr/XMLHttpRequestMainThread.cpp
+++ b/dom/xhr/XMLHttpRequestMainThread.cpp
@@ -2063,16 +2063,17 @@ XMLHttpRequestMainThread::OnStopRequest(
   mXMLParserStreamListener = nullptr;
   mContext = nullptr;
 
   // If window.stop() or other aborts were issued, handle as an abort
   if (status == NS_BINDING_ABORTED) {
     mFlagParseBody = false;
     IgnoredErrorResult rv;
     RequestErrorSteps(ProgressEventType::abort, NS_OK, rv);
+    ChangeState(XMLHttpRequest_Binding::UNSENT, false);
     return NS_OK;
   }
 
   // If we were just reading a blob URL, we're already done
   if (status == NS_ERROR_FILE_ALREADY_EXISTS && mResponseBlob) {
     ChangeStateToDone();
     return NS_OK;
   }
--- a/testing/web-platform/tests/xhr/abort-after-stop.htm
+++ b/testing/web-platform/tests/xhr/abort-after-stop.htm
@@ -12,16 +12,17 @@
       var test = async_test();
       window.onload = test.step_func(function() {
         var client = new XMLHttpRequest();
         var abortFired = false;
         var sync = true;
         client.onabort = test.step_func(function (e) {
           assert_false(sync);
           assert_equals(e.type, 'abort');
+          assert_equals(client.status, 0);
           abortFired = true;
         });
         client.open("GET", "resources/delay.py?ms=3000", true);
         client.send(null);
         test.step_timeout(() => {
           assert_equals(abortFired, true);
           test.done();
         }, 200);