diff options
Diffstat (limited to 'dom/xhr/XMLHttpRequestWorker.cpp')
-rw-r--r-- | dom/xhr/XMLHttpRequestWorker.cpp | 7 |
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 |