Bug 999274 - Wait for the last runnable before calling ShutdownScriptLoader. r=sicking, a=abillings
authorBen Turner <bent.mozilla@gmail.com>
Tue, 20 May 2014 08:34:25 -0400
changeset 192342 50428e91f0bc
parent 192341 8438a548150d
child 192343 542f83ec6345
push id3575
push userryanvm@gmail.com
push date2014-05-20 20:33 +0000
Treeherderresults
reviewerssicking, abillings
bugs999274
milestone30.0
Bug 999274 - Wait for the last runnable before calling ShutdownScriptLoader. r=sicking, a=abillings
dom/workers/ScriptLoader.cpp
--- a/dom/workers/ScriptLoader.cpp
+++ b/dom/workers/ScriptLoader.cpp
@@ -745,17 +745,19 @@ ScriptExecutorRunnable::PostRun(JSContex
 
     ShutdownScriptLoader(aCx, aWorkerPrivate, result);
   }
 }
 
 NS_IMETHODIMP
 ScriptExecutorRunnable::Cancel()
 {
-  ShutdownScriptLoader(mWorkerPrivate->GetJSContext(), mWorkerPrivate, false);
+  if (mLastIndex == mScriptLoader.mLoadInfos.Length() - 1) {
+    ShutdownScriptLoader(mWorkerPrivate->GetJSContext(), mWorkerPrivate, false);
+  }
   return MainThreadWorkerSyncRunnable::Cancel();
 }
 
 void
 ScriptExecutorRunnable::ShutdownScriptLoader(JSContext* aCx,
                                              WorkerPrivate* aWorkerPrivate,
                                              bool aResult)
 {