Bug 1362354 - Send abort event if window.stop() is called, r=baku
☠☠ backed out by 0739667c0205 ☠ ☠
authorShawn Huang <shuang@mozilla.com>
Thu, 27 Jul 2017 17:50:13 +0800
changeset 422495 6ed95396bdb623610e88b4d59ed267d513ae2886
parent 422494 5e9f7561c2eba9eaa1f88833a01db0f242751f7d
child 422496 5f396e8e22faa2852a29f3e1bfda22018f5aa3ca
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1362354
milestone56.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 1362354 - Send abort event if window.stop() is called, r=baku Per XHR 4.5.6, end-user abort, it is required to send abort event. This fixed test XMLHttpRequest/abort-after-stop.htm.
dom/xhr/XMLHttpRequestMainThread.cpp
testing/web-platform/meta/XMLHttpRequest/abort-after-stop.htm.ini
--- a/dom/xhr/XMLHttpRequestMainThread.cpp
+++ b/dom/xhr/XMLHttpRequestMainThread.cpp
@@ -2232,16 +2232,24 @@ XMLHttpRequestMainThread::OnStopRequest(
 {
   AUTO_PROFILER_LABEL("XMLHttpRequestMainThread::OnStopRequest", NETWORK);
 
   if (request != mChannel) {
     // Can this still happen?
     return NS_OK;
   }
 
+  if (status == NS_BINDING_ABORTED &&
+      ((mState == State::opened && mFlagSend) ||
+        mState == State::headers_received ||
+        mState == State::loading)) {
+    // Make sure we send event abort if termination reason is end-user abort.
+    Abort();
+  }
+
   mWaitingForOnStopRequest = false;
 
   if (mRequestObserver) {
     NS_ASSERTION(mFirstStartRequestSeen, "Inconsistent state!");
     mFirstStartRequestSeen = false;
     mRequestObserver->OnStopRequest(request, ctxt, status);
   }
 
--- a/testing/web-platform/meta/XMLHttpRequest/abort-after-stop.htm.ini
+++ b/testing/web-platform/meta/XMLHttpRequest/abort-after-stop.htm.ini
@@ -1,6 +1,4 @@
 [abort-after-stop.htm]
   type: testharness
   expected: TIMEOUT
-  [XMLHttpRequest: abort event should fire when stop() method is used]
-    expected: FAIL