diff --git a/dom/src/threads/nsDOMThreadService.cpp b/dom/src/threads/nsDOMThreadService.cpp index 39ab40ce13cb..12d52164f8ff 100644 --- a/dom/src/threads/nsDOMThreadService.cpp +++ b/dom/src/threads/nsDOMThreadService.cpp @@ -558,7 +558,7 @@ DOMWorkerOperationCallback(JSContext* aCx) // above in which case we shouldn't wait here. We're guaranteed not to race // here because the pool reenters its monitor after canceling each worker // in order to notify its condition variable. - if (!worker->IsCanceled()) { + if (worker->IsSuspended() && !worker->IsCanceled()) { mon.Wait(); } } diff --git a/dom/src/threads/nsDOMWorkerPool.cpp b/dom/src/threads/nsDOMWorkerPool.cpp index 17146b3ce6db..4c5b9001d8c3 100644 --- a/dom/src/threads/nsDOMWorkerPool.cpp +++ b/dom/src/threads/nsDOMWorkerPool.cpp @@ -164,9 +164,9 @@ nsDOMWorkerPool::NoteDyingWorker(nsDOMWorker* aWorker) void nsDOMWorkerPool::GetWorkers(nsTArray& aArray) { - aArray.Clear(); + PR_ASSERT_CURRENT_THREAD_IN_MONITOR(mMonitor); + NS_ASSERTION(!aArray.Length(), "Should be empty!"); - nsAutoMonitor mon(mMonitor); #ifdef DEBUG nsDOMWorker** newWorkers = #endif