Bug 1546331 - Missing call to WaitForIsDebuggerRegistered r=asuth
authorEden Chuang <echuang@mozilla.com>
Wed, 13 Nov 2019 12:56:27 +0000
changeset 502166 cde2ca39e32b7e344ebd4f6eac900c7ac1dee26a
parent 502165 e4ed5d091e3dd498dbeb416ece8399ffcf13d52e
child 502167 956e4283483b7be971b2446c6bcaa005dd067d14
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth
bugs1546331
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1546331 - Missing call to WaitForIsDebuggerRegistered r=asuth Differential Revision: https://phabricator.services.mozilla.com/D52139
dom/workers/WorkerPrivate.cpp
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -1463,16 +1463,22 @@ void WorkerPrivate::EnableDebugger() {
     NS_WARNING("Failed to register worker debugger!");
     return;
   }
 }
 
 void WorkerPrivate::DisableDebugger() {
   AssertIsOnParentThread();
 
+  // RegisterDebuggerMainThreadRunnable might be dispatched but not executed.
+  // Wait for its execution before unregistraion.
+  if (!NS_IsMainThread()) {
+    WaitForIsDebuggerRegistered(true);
+  }
+
   if (NS_FAILED(UnregisterWorkerDebugger(this))) {
     NS_WARNING("Failed to unregister worker debugger!");
   }
 }
 
 nsresult WorkerPrivate::DispatchControlRunnable(
     already_AddRefed<WorkerControlRunnable> aWorkerControlRunnable) {
   // May be called on any thread!