From f3127851fa45d7279b64f966502063fb91aadcab Mon Sep 17 00:00:00 2001 From: Shian-Yow Wu Date: Fri, 6 Jun 2014 12:12:15 +0100 Subject: [PATCH] Bug 1014466 - Part 2: Allow setting responseType after abort() or new open(). r=khuey --- dom/workers/XMLHttpRequest.cpp | 12 ++++++++++-- dom/workers/XMLHttpRequest.h | 12 ++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/dom/workers/XMLHttpRequest.cpp b/dom/workers/XMLHttpRequest.cpp index 37a090769a2..cefd183eb4c 100644 --- a/dom/workers/XMLHttpRequest.cpp +++ b/dom/workers/XMLHttpRequest.cpp @@ -279,7 +279,9 @@ private: bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) { - mXMLHttpRequestPrivate->Unpin(); + if (mXMLHttpRequestPrivate->SendInProgress()) { + mXMLHttpRequestPrivate->Unpin(); + } return true; } @@ -353,7 +355,9 @@ class LoadStartDetectionRunnable MOZ_FINAL : public nsRunnable, aWorkerPrivate->StopSyncLoop(mSyncLoopTarget, true); } - mXMLHttpRequestPrivate->Unpin(); + if (mXMLHttpRequestPrivate->SendInProgress()) { + mXMLHttpRequestPrivate->Unpin(); + } return true; } @@ -1716,6 +1720,10 @@ XMLHttpRequest::MaybeDispatchPrematureAbortEvents(ErrorResult& aRv) mProxy->mSeenLoadStart = false; } + + if (mRooted) { + Unpin(); + } } void diff --git a/dom/workers/XMLHttpRequest.h b/dom/workers/XMLHttpRequest.h index 1006eefb74f..cc692e9534d 100644 --- a/dom/workers/XMLHttpRequest.h +++ b/dom/workers/XMLHttpRequest.h @@ -264,6 +264,12 @@ public: return mMozSystem; } + bool + SendInProgress() const + { + return mRooted; + } + private: XMLHttpRequest(WorkerPrivate* aWorkerPrivate); ~XMLHttpRequest(); @@ -284,12 +290,6 @@ private: const nsAString& aEventType, bool aUploadTarget, ErrorResult& aRv); - bool - SendInProgress() const - { - return mRooted; - } - void SendInternal(const nsAString& aStringBody, JSAutoStructuredCloneBuffer&& aBody,