tor-browser

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

commit 1c9ebb9aec7e8f5b118905bf956c1395b05b5890
parent 06166ae6872b1c95e46ab4edad421966387469e5
Author: Matthew Gaudet <mgaudet@mozilla.com>
Date:   Fri, 28 Nov 2025 21:41:20 +0000

Bug 2002876 - Remove un-necessary copy & move root out of loop r=smaug

Using the assignment ends up triggering a copy which is un-necesary.

Differential Revision: https://phabricator.services.mozilla.com/D274353

Diffstat:
Mxpcom/base/CycleCollectedJSContext.cpp | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xpcom/base/CycleCollectedJSContext.cpp b/xpcom/base/CycleCollectedJSContext.cpp @@ -1197,7 +1197,7 @@ bool CycleCollectedJSContext::PerformMicroTaskCheckPoint(bool aForce) { while (JS::HasAnyMicroTasks(cx)) { MOZ_ASSERT(mDebuggerMicroTaskQueue.empty()); MOZ_ASSERT(mPendingMicroTaskRunnables.empty()); - job = DequeueNextMicroTask(cx); + job.set(DequeueNextMicroTask(cx)); // To avoid us accidentally re-enqueing a SuppressionMicroTaskList in // itself, we determine here if the job is actually the suppression task @@ -1327,11 +1327,11 @@ void CycleCollectedJSContext::PerformDebuggerMicroTaskCheckpoint() { JSContext* cx = Context(); if (StaticPrefs::javascript_options_use_js_microtask_queue()) { + JS::Rooted<MustConsumeMicroTask> job(cx); while (JS::HasDebuggerMicroTasks(cx)) { MOZ_ASSERT(mDebuggerMicroTaskQueue.empty()); MOZ_ASSERT(mPendingMicroTaskRunnables.empty()); - JS::Rooted<MustConsumeMicroTask> job(cx); job.set(DequeueNextDebuggerMicroTask(cx)); RunMicroTask(cx, &job);