tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit cd3e4a5df2ba5a4a92f94830c1a681e1cdfb0519
parent eef4c572602f61eabc1e53a5b2e1303ffd7621cf
Author: agoloman <agoloman@mozilla.com>
Date:   Fri, 21 Nov 2025 20:25:38 +0200

Revert "Bug 1990233 - WorkerPrivate: unify TimeoutManager Thaw()/Freeze() Resume()/Suspend() logic, r=smaug" for causing mochitest failures.

This reverts commit 72a7b93d81bf508b084609a67a8a53b1a955b34b.

Diffstat:
Mdom/workers/WorkerPrivate.cpp | 68+++++++-------------------------------------------------------------
Mdom/workers/WorkerPrivate.h | 6------
2 files changed, 7 insertions(+), 67 deletions(-)

diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp @@ -512,19 +512,6 @@ class FreezeRunnable final : public WorkerControlRunnable { } }; -class SuspendRunnable final : public WorkerControlRunnable { - public: - explicit SuspendRunnable(WorkerPrivate* aWorkerPrivate, bool aSuspend) - : WorkerControlRunnable("SuspendRunnable"), mSuspend{aSuspend} {} - - private: - bool mSuspend = false; - virtual bool WorkerRun(JSContext* aCx, - WorkerPrivate* aWorkerPrivate) override { - return aWorkerPrivate->SuspendTimeoutManagerInternal(mSuspend); - } -}; - class ThawRunnable final : public WorkerControlRunnable { public: explicit ThawRunnable(WorkerPrivate* aWorkerPrivate) @@ -2261,15 +2248,11 @@ void WorkerPrivate::ParentWindowPaused() { MOZ_ALWAYS_SUCCEEDS( mMainThreadDebuggeeEventTarget->SetIsPaused(!isCanceling)); } - - SuspendTimeoutManager(); } void WorkerPrivate::ParentWindowResumed() { AssertIsOnMainThread(); - ResumeTimeoutManager(); - MOZ_ASSERT(mParentWindowPaused); mParentWindowPaused = false; @@ -4790,47 +4773,9 @@ bool WorkerPrivate::FreezeInternal() { auto* timeoutManager = data->mScope ? data->mScope->GetTimeoutManager() : nullptr; if (timeoutManager) { - timeoutManager->Freeze(); - } - - return true; -} - -bool WorkerPrivate::SuspendTimeoutManager() { - AssertIsOnParentThread(); - RefPtr<SuspendRunnable> runnable = new SuspendRunnable(this, true); - runnable->Dispatch(this); - return true; -} - -bool WorkerPrivate::ResumeTimeoutManager() { - AssertIsOnParentThread(); - RefPtr<SuspendRunnable> runnable = new SuspendRunnable(this, false); - runnable->Dispatch(this); - return true; -} - -bool WorkerPrivate::SuspendTimeoutManagerInternal(bool aSuspend) { - AssertIsOnWorkerThread(); - auto data = mWorkerThreadAccessible.Access(); - - for (uint32_t index = 0; index < data->mChildWorkers.Length(); index++) { - if (aSuspend) { - data->mChildWorkers[index]->SuspendTimeoutManager(); - } else { - data->mChildWorkers[index]->ResumeTimeoutManager(); - } + timeoutManager->Suspend(); } - auto* timeoutManager = - data->mScope ? data->mScope->GetTimeoutManager() : nullptr; - if (timeoutManager) { - if (aSuspend) { - timeoutManager->Suspend(); - } else { - timeoutManager->Resume(); - } - } return true; } @@ -4848,11 +4793,6 @@ bool WorkerPrivate::ThawInternal() { NS_ASSERTION(data->mFrozen, "Not yet frozen!"); // BindRemoteWorkerDebuggerChild(); - auto* timeoutManager = - data->mScope ? data->mScope->GetTimeoutManager() : nullptr; - if (timeoutManager) { - timeoutManager->Thaw(); - } for (uint32_t index = 0; index < data->mChildWorkers.Length(); index++) { data->mChildWorkers[index]->Thaw(nullptr); @@ -4865,6 +4805,12 @@ bool WorkerPrivate::ThawInternal() { data->mScope->MutableClientSourceRef().Thaw(); } + auto* timeoutManager = + data->mScope ? data->mScope->GetTimeoutManager() : nullptr; + if (timeoutManager) { + timeoutManager->Resume(); + } + return true; } diff --git a/dom/workers/WorkerPrivate.h b/dom/workers/WorkerPrivate.h @@ -409,12 +409,6 @@ class WorkerPrivate final bool FreezeInternal(); - bool SuspendTimeoutManager(); - - bool ResumeTimeoutManager(); - - bool SuspendTimeoutManagerInternal(bool aSuspend); - bool ThawInternal(); void PropagateStorageAccessPermissionGrantedInternal();