diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp index d97e538fce3..66573fd2eee 100644 --- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -1668,7 +1668,7 @@ RuntimeService::UnregisterWorker(JSContext* aCx, WorkerPrivate* aWorkerPrivate) } } - if (!domainInfo->ActiveWorkerCount()) { + if (domainInfo->HasNoWorkers()) { MOZ_ASSERT(domainInfo->mQueuedWorkers.IsEmpty()); mDomainMap.Remove(domain); } diff --git a/dom/workers/RuntimeService.h b/dom/workers/RuntimeService.h index aa27cc085bc..984c32b6f8c 100644 --- a/dom/workers/RuntimeService.h +++ b/dom/workers/RuntimeService.h @@ -56,9 +56,21 @@ class RuntimeService final : public nsIObserver ActiveWorkerCount() const { return mActiveWorkers.Length() + - mActiveServiceWorkers.Length() + mChildWorkerCount; } + + uint32_t + ActiveServiceWorkerCount() const + { + return mActiveServiceWorkers.Length(); + } + + bool + HasNoWorkers() const + { + return ActiveWorkerCount() == 0 && + ActiveServiceWorkerCount() == 0; + } }; struct IdleThreadInfo;