summaryrefslogtreecommitdiffstats
path: root/dom/xhr/XMLHttpRequestWorker.cpp
diff options
context:
space:
mode:
authorNew Tobin Paradigm <email@mattatobin.com>2018-04-14 03:19:49 -0400
committerGitHub <noreply@github.com>2018-04-14 03:19:49 -0400
commitc73c73b7978d7fc12e0dc07bb7c8f3babd497b8c (patch)
tree83a7c01fdc30d17a884c5c482bec51e60390c9e4 /dom/xhr/XMLHttpRequestWorker.cpp
parent63d482639cef4e5df364d707a21660c36b576f7b (diff)
parentee15761a5073435d10aba49b3a11245e8331635d (diff)
downloadUXP-c73c73b7978d7fc12e0dc07bb7c8f3babd497b8c.tar
UXP-c73c73b7978d7fc12e0dc07bb7c8f3babd497b8c.tar.gz
UXP-c73c73b7978d7fc12e0dc07bb7c8f3babd497b8c.tar.lz
UXP-c73c73b7978d7fc12e0dc07bb7c8f3babd497b8c.tar.xz
UXP-c73c73b7978d7fc12e0dc07bb7c8f3babd497b8c.zip
Merge pull request #131 from janekptacijarabaci/js_dom_xmlhttprequest_abort_1
Aligned XMLHttpRequest abort() with the spec
Diffstat (limited to 'dom/xhr/XMLHttpRequestWorker.cpp')
-rw-r--r--dom/xhr/XMLHttpRequestWorker.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/dom/xhr/XMLHttpRequestWorker.cpp b/dom/xhr/XMLHttpRequestWorker.cpp
index 93b93a2b1..e7193a279 100644
--- a/dom/xhr/XMLHttpRequestWorker.cpp
+++ b/dom/xhr/XMLHttpRequestWorker.cpp
@@ -1669,7 +1669,9 @@ XMLHttpRequestWorker::MaybeDispatchPrematureAbortEvents(ErrorResult& aRv)
// Only send readystatechange event when state changed.
bool isStateChanged = false;
- if (mStateData.mReadyState != 4) {
+ if ((mStateData.mReadyState == 1 && mStateData.mFlagSend) ||
+ mStateData.mReadyState == 2 ||
+ mStateData.mReadyState == 3) {
isStateChanged = true;
mStateData.mReadyState = 4;
}
@@ -1811,6 +1813,8 @@ XMLHttpRequestWorker::SendInternal(SendRunnable* aRunnable,
aRunnable->SetSyncLoopTarget(syncLoopTarget);
aRunnable->SetHaveUploadListeners(hasUploadListeners);
+ mStateData.mFlagSend = true;
+
aRunnable->Dispatch(aRv);
if (aRv.Failed()) {
// Dispatch() may have spun the event loop and we may have already unrooted.
@@ -1837,6 +1841,7 @@ XMLHttpRequestWorker::SendInternal(SendRunnable* aRunnable,
if (!autoSyncLoop->Run() && !aRv.Failed()) {
aRv.Throw(NS_ERROR_FAILURE);
}
+ mStateData.mFlagSend = false;
}
bool