Bug 2070925 - Make setDebuggerReady(false) suspend the debuggee again, r=edenchuang,dom-worker-reviewers.

The hold suspended nothing: !mDebuggerReady && !mRemoteDebuggerReady can never
both be true, since the two flags are cleared on mutually exclusive
UseRemoteDebugger() branches. So no debuggee runnable has been queued since
Bug 1899503.

Restoring the hold means the three flush sites drop the mDebuggerRegistered term,
which a remote worker never sets, and which RegisterDebuggerMainThread has
normally already set for a local one.

Differential Revision: https://phabricator.services.mozilla.com/D325036
This commit is contained in:
Florian Quèze
2026-09-11 11:30:02 +00:00
committed by fqueze@mozilla.com
parent 4ccc3b2b3b
commit 52f64e7e39
2 changed files with 10 additions and 14 deletions
+7 -12
View File
@@ -1641,11 +1641,10 @@ nsresult WorkerPrivate::DispatchLockHeld(
return NS_ERROR_UNEXPECTED;
}
// Postpone the debuggee runnable dispatching while remote debugger
// registration
if (runnable->IsDebuggeeRunnable() && !mDebuggerReady &&
!mRemoteDebuggerReady &&
(!mRemoteDebuggerRegistered && XRE_IsParentProcess())) {
// Suspend the debuggee while the debugger has asked us to, through either the
// local or the remote mechanism.
if (runnable->IsDebuggeeRunnable() &&
!(mDebuggerReady && mRemoteDebuggerReady)) {
MOZ_RELEASE_ASSERT(!aSyncLoopTarget);
mDelayedDebuggeeRunnables.AppendElement(runnable);
return NS_OK;
@@ -1796,8 +1795,7 @@ void WorkerPrivate::SetIsRemoteDebuggerRegistered(const bool& aRegistered) {
MOZ_ASSERT(mRemoteDebuggerRegistered != aRegistered);
mRemoteDebuggerRegistered = aRegistered;
bool debuggerRegistered = mDebuggerRegistered && mRemoteDebuggerRegistered;
if (mRemoteDebuggerReady && mDebuggerReady && debuggerRegistered) {
if (mRemoteDebuggerReady && mDebuggerReady) {
LOGV(
("WorkerPrivate::SetIsRemoteDebuggerRegistered [%p] dispatching "
"the delayed debuggee runnables",
@@ -1856,7 +1854,7 @@ void WorkerPrivate::SetIsRemoteDebuggerReady(const bool& aReady) {
mRemoteDebuggerReady = aReady;
if (mRemoteDebuggerReady && mDebuggerReady && debuggerRegistered) {
if (mRemoteDebuggerReady && mDebuggerReady) {
LOGV(
("WorkerPrivate::SetIsRemoteDebuggerReady [%p] dispatching "
"the delayed debuggee runnables",
@@ -3384,10 +3382,7 @@ nsresult WorkerPrivate::SetIsDebuggerReady(bool aReady) {
mDebuggerReady = aReady;
bool debuggerRegistered = mDebuggerRegistered && (mRemoteDebuggerRegistered ||
XRE_IsParentProcess());
if (aReady && debuggerRegistered) {
if (mDebuggerReady && mRemoteDebuggerReady) {
// Dispatch all the delayed runnables without releasing the lock, to ensure
// that the order in which debuggee runnables execute is the same as the
// order in which they were originally dispatched.
+3 -2
View File
@@ -1121,8 +1121,9 @@ class WorkerPrivate final
// Whether this worker exposes its debugger through the parent-process
// RemoteWorkerDebugger mechanism (true) or registers its nsIWorkerDebugger on
// the local main thread (false). Latched at construction from
// dom.worker.remoteDebugger.enabled; always false in the parent process. The
// two mechanisms are mutually exclusive for a given worker.
// dom.worker.remoteDebugger.enabled, and for a parent-process worker also
// from RemoteWorkerService::IsInitialized(); see the mUseRemoteDebugger
// initializer. The two mechanisms are mutually exclusive for a given worker.
bool UseRemoteDebugger() const { return mUseRemoteDebugger; }
void SetIsQueued(const bool& aQueued);