summaryrefslogtreecommitdiffstats
path: root/dom/xhr/XMLHttpRequestWorker.cpp
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-15 19:18:30 +0100
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-15 19:18:30 +0100
commitee15761a5073435d10aba49b3a11245e8331635d (patch)
tree7bb3257c4561acb47acb3e92f0386ef291911daf /dom/xhr/XMLHttpRequestWorker.cpp
parent0d3ee51ad2d61bffba14232b2df913d3a773d771 (diff)
downloadUXP-ee15761a5073435d10aba49b3a11245e8331635d.tar
UXP-ee15761a5073435d10aba49b3a11245e8331635d.tar.gz
UXP-ee15761a5073435d10aba49b3a11245e8331635d.tar.lz
UXP-ee15761a5073435d10aba49b3a11245e8331635d.tar.xz
UXP-ee15761a5073435d10aba49b3a11245e8331635d.zip
Bug 1311798: Align 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 f61383baf..4869d0099 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