Bug 1169867 - XMLHttpRequest::SendInternal should not unpin itself when the worker goes away. r=bent, a=abillings
authorAndrea Marchesini <amarchesini@mozilla.com>
Fri, 12 Jun 2015 10:06:19 -0400
changeset 201230 4028bc28f4c681a57919d94f078fb24bfa107ca8
parent 201229 5abcf220d3ea5d01420c976da83547350c67e69d
child 201231 367913358bde4423498f19c769a50556c0de1ae4
push id288
push userryanvm@gmail.com
push dateMon, 15 Jun 2015 13:41:49 +0000
treeherdermozilla-esr31@4028bc28f4c6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent, abillings
bugs1169867
milestone31.7.0
Bug 1169867 - XMLHttpRequest::SendInternal should not unpin itself when the worker goes away. r=bent, a=abillings
dom/workers/XMLHttpRequest.cpp
--- a/dom/workers/XMLHttpRequest.cpp
+++ b/dom/workers/XMLHttpRequest.cpp
@@ -1824,16 +1824,21 @@ XMLHttpRequest::SendInternal(const nsASt
   mProxy->mOuterChannelId++;
 
   JSContext* cx = mWorkerPrivate->GetJSContext();
 
   nsRefPtr<SendRunnable> runnable =
     new SendRunnable(mWorkerPrivate, mProxy, aStringBody, Move(aBody),
                      aClonedObjects, syncLoopTarget, hasUploadListeners);
   if (!runnable->Dispatch(cx)) {
+    // Dispatch() may have spun the event loop and we may have already unrooted.
+    // If so we don't want autoUnpin to try again.
+    if (!mRooted) {
+      autoUnpin.Clear();
+    }
     aRv.Throw(NS_ERROR_FAILURE);
     return;
   }
 
   if (!isSyncXHR)  {
     autoUnpin.Clear();
     MOZ_ASSERT(autoSyncLoop.empty());
     return;