diff --git a/dom/workers/WorkerRunnable.cpp b/dom/workers/WorkerRunnable.cpp index 40a75f072656..d95423652b11 100644 --- a/dom/workers/WorkerRunnable.cpp +++ b/dom/workers/WorkerRunnable.cpp @@ -730,10 +730,14 @@ WorkerProxyToMainThreadRunnable::PostDispatchOnMainThread() MOZ_ASSERT(aWorkerPrivate); aWorkerPrivate->AssertIsOnWorkerThread(); - mRunnable->RunBackOnWorkerThread(); + if (mRunnable) { + mRunnable->RunBackOnWorkerThread(); + + // Let's release the worker thread. + mRunnable->ReleaseWorker(); + mRunnable = nullptr; + } - // Let's release the worker thread. - mRunnable->ReleaseWorker(); return true; }