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 521382 9c46b805faeb
parent 521381 b761a7b69aba
child 521383 e37e74e923b9
push id10866
push usernerli@mozilla.com
push dateTue, 12 Mar 2019 18:59:09 +0000
treeherdermozilla-beta@445c24a51727 [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);