summaryrefslogtreecommitdiffstats
path: root/dom/workers
diff options
context:
space:
mode:
Diffstat (limited to 'dom/workers')
-rw-r--r--dom/workers/WorkerPrivate.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp
index 27eb570e9..c6ef21f2c 100644
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -2543,6 +2543,12 @@ WorkerPrivateParent<Derived>::DisableDebugger()
WorkerPrivate* self = ParentAsWorkerPrivate();
+ // RegisterDebugger might have been dispatched but not completed.
+ // Wait for its execution to complete before unregistering.
+ if (!NS_IsMainThread()) {
+ self->WaitForIsDebuggerRegistered(true);
+ }
+
if (NS_FAILED(UnregisterWorkerDebugger(self))) {
NS_WARNING("Failed to unregister worker debugger!");
}