Backed out changeset d5c26d99978e (bug 1642193) for wpt failures on event-timeout-order.any.worker.html . CLOSED TREE
authorNarcis Beleuzu <nbeleuzu@mozilla.com>
Wed, 10 Jun 2020 17:14:24 +0300
changeset 598937 fca2a64739b13da32d93ee5d48f6bd2e2f23fadc
parent 598936 9f3871bb562a7ad2dd56132fb627d57d12044de6
child 598938 2b9a70901fd8e97f413c7487d9b9c10f35dacf50
push id13310
push userffxbld-merge
push dateMon, 29 Jun 2020 14:50:06 +0000
treeherdermozilla-beta@15a59a0afa5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1642193
milestone79.0a1
backs outd5c26d99978e5ffd72406a9a55795eddd03a47c9
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
Backed out changeset d5c26d99978e (bug 1642193) for wpt failures on event-timeout-order.any.worker.html . CLOSED TREE
dom/xhr/XMLHttpRequestWorker.cpp
testing/web-platform/meta/xhr/abort-upload-event-abort.any.js.ini
testing/web-platform/meta/xhr/abort-upload-event-loadend.any.js.ini
testing/web-platform/meta/xhr/event-timeout-order.any.js.ini
--- a/dom/xhr/XMLHttpRequestWorker.cpp
+++ b/dom/xhr/XMLHttpRequestWorker.cpp
@@ -115,18 +115,16 @@ class Proxy final : public nsIDOMEventLi
   uint64_t mLastTotal;
   uint64_t mLastUploadLoaded;
   uint64_t mLastUploadTotal;
   bool mIsSyncXHR;
   bool mLastLengthComputable;
   bool mLastUploadLengthComputable;
   bool mSeenLoadStart;
   bool mSeenUploadLoadStart;
-  bool mDispatchPrematureAbortEvent;
-  bool mDispatchPrematureAbortEventToUpload;
 
   // Only touched on the main thread.
   bool mUploadEventListenersAttached;
   bool mMainThreadSeenLoadStart;
   bool mInOpen;
 
  public:
   Proxy(XMLHttpRequestWorker* aXHRPrivate, const ClientInfo& aClientInfo,
@@ -148,18 +146,16 @@ class Proxy final : public nsIDOMEventLi
         mLastTotal(0),
         mLastUploadLoaded(0),
         mLastUploadTotal(0),
         mIsSyncXHR(false),
         mLastLengthComputable(false),
         mLastUploadLengthComputable(false),
         mSeenLoadStart(false),
         mSeenUploadLoadStart(false),
-        mDispatchPrematureAbortEvent(false),
-        mDispatchPrematureAbortEventToUpload(false),
         mUploadEventListenersAttached(false),
         mMainThreadSeenLoadStart(false),
         mInOpen(false) {}
 
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIDOMEVENTLISTENER
 
   bool Init();
@@ -261,40 +257,40 @@ namespace {
 
 enum {
   STRING_abort = 0,
   STRING_error,
   STRING_load,
   STRING_loadstart,
   STRING_progress,
   STRING_timeout,
+  STRING_readystatechange,
   STRING_loadend,
-  STRING_readystatechange,
 
   STRING_COUNT,
 
-  STRING_LAST_XHR = STRING_readystatechange,
-  STRING_LAST_EVENTTARGET = STRING_loadend
+  STRING_LAST_XHR = STRING_loadend,
+  STRING_LAST_EVENTTARGET = STRING_timeout
 };
 
 static_assert(STRING_LAST_XHR >= STRING_LAST_EVENTTARGET, "Bad string setup!");
 static_assert(STRING_LAST_XHR == STRING_COUNT - 1, "Bad string setup!");
 
 const char* const sEventStrings[] = {
     // XMLHttpRequestEventTarget event types, supported by both XHR and Upload.
     "abort",
     "error",
     "load",
     "loadstart",
     "progress",
     "timeout",
-    "loadend",
 
     // XMLHttpRequest event types, supported only by XHR.
     "readystatechange",
+    "loadend",
 };
 
 static_assert(MOZ_ARRAY_LENGTH(sEventStrings) == STRING_COUNT,
               "Bad string count!");
 
 class MainThreadProxyRunnable : public MainThreadWorkerSyncRunnable {
  protected:
   RefPtr<Proxy> mProxy;
@@ -1069,30 +1065,26 @@ bool EventRunnable::WorkerRun(JSContext*
     if (mUploadEvent) {
       mProxy->mSeenUploadLoadStart = true;
     } else {
       mProxy->mSeenLoadStart = true;
     }
   } else if (mType.EqualsASCII(sEventStrings[STRING_loadend])) {
     if (mUploadEvent) {
       mProxy->mSeenUploadLoadStart = false;
-      if (mProxy->mDispatchPrematureAbortEventToUpload) {
+    } else {
+      if (!mProxy->mSeenLoadStart) {
         // We've already dispatched premature abort events.
         return true;
       }
-    } else {
       mProxy->mSeenLoadStart = false;
-      if (mProxy->mDispatchPrematureAbortEvent) {
-        // We've already dispatched premature abort events.
-        return true;
-      }
     }
   } else if (mType.EqualsASCII(sEventStrings[STRING_abort])) {
-    if ((mUploadEvent && mProxy->mDispatchPrematureAbortEventToUpload) ||
-        (!mUploadEvent && mProxy->mDispatchPrematureAbortEvent)) {
+    if ((mUploadEvent && !mProxy->mSeenUploadLoadStart) ||
+        (!mUploadEvent && !mProxy->mSeenLoadStart)) {
       // We've already dispatched premature abort events.
       return true;
     }
   }
 
   if (mProgressEvent) {
     // Cache these for premature abort events.
     if (mUploadEvent) {
@@ -1501,17 +1493,16 @@ void XMLHttpRequestWorker::MaybeDispatch
 
     // Similarly to null check in ::Open, mProxy may have been cleared here.
     if (!mProxy) {
       aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
       return;
     }
 
     mProxy->mSeenUploadLoadStart = false;
-    mProxy->mDispatchPrematureAbortEventToUpload = true;
   }
 
   if (mProxy->mSeenLoadStart) {
     if (isStateChanged) {
       DispatchPrematureAbortEvent(this, NS_LITERAL_STRING("readystatechange"),
                                   false, aRv);
       if (aRv.Failed()) {
         return;
@@ -1530,17 +1521,16 @@ void XMLHttpRequestWorker::MaybeDispatch
 
     // Similarly to null check in ::Open, mProxy may have been cleared here.
     if (!mProxy) {
       aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
       return;
     }
 
     mProxy->mSeenLoadStart = false;
-    mProxy->mDispatchPrematureAbortEvent = true;
   }
 }
 
 void XMLHttpRequestWorker::DispatchPrematureAbortEvent(
     EventTarget* aTarget, const nsAString& aEventType, bool aUploadTarget,
     ErrorResult& aRv) {
   mWorkerPrivate->AssertIsOnWorkerThread();
   MOZ_ASSERT(aTarget);
@@ -1648,18 +1638,16 @@ void XMLHttpRequestWorker::SendInternal(
     syncLoopTarget = autoSyncLoop->GetEventTarget();
     if (!syncLoopTarget) {
       aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
       return;
     }
   }
 
   mProxy->mOuterChannelId++;
-  mProxy->mDispatchPrematureAbortEvent = false;
-  mProxy->mDispatchPrematureAbortEventToUpload = false;
 
   sendRunnable->SetSyncLoopTarget(syncLoopTarget);
   sendRunnable->SetHaveUploadListeners(hasUploadListeners);
 
   mStateData->mFlagSend = true;
 
   sendRunnable->Dispatch(Canceling, aRv);
   if (aRv.Failed()) {
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/xhr/abort-upload-event-abort.any.js.ini
@@ -0,0 +1,7 @@
+[abort-upload-event-abort.any.worker.html]
+  expected: TIMEOUT
+  [XMLHttpRequest: The abort() method: Fire a progress event named abort on the XMLHttpRequestUpload object]
+    expected: TIMEOUT
+
+
+[abort-upload-event-abort.any.html]
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/xhr/abort-upload-event-loadend.any.js.ini
@@ -0,0 +1,7 @@
+[abort-upload-event-loadend.any.html]
+
+[abort-upload-event-loadend.any.worker.html]
+  expected: TIMEOUT
+  [XMLHttpRequest: The abort() method: Fire a progress event named loadend on the XMLHttpRequestUpload object]
+    expected: TIMEOUT
+
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/xhr/event-timeout-order.any.js.ini
@@ -0,0 +1,6 @@
+[event-timeout-order.any.html]
+
+[event-timeout-order.any.worker.html]
+  [XMLHttpRequest: event - timeout (order of events)]
+    expected: FAIL
+