tor-browser

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

commit b38ebfaf2dd24b1e210c4fee5a92c89f5d49e8c0
parent 391779f66db9cd4060ff5937722dbd8b80cd5e16
Author: Mike Conley <mconley@mozilla.com>
Date:   Mon, 20 Oct 2025 14:56:53 +0000

Bug 1983851 - Remove ChromeUtils.now newtab train-hop compatibility shims now that Firefox 144 has shipped. r=florian,home-newtab-reviewers,thecount

These shims were added in bug 1983850.

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

Diffstat:
Mbrowser/extensions/newtab/lib/TelemetryFeed.sys.mjs | 8++------
Mtesting/mochitest/BrowserTestUtils/BrowserTestUtils.sys.mjs | 24++++++------------------
Mtesting/mochitest/browser-test.js | 8++------
Mtesting/mochitest/tests/SimpleTest/TestRunner.js | 5+----
Mtesting/modules/TestUtils.sys.mjs | 8++------
Mtesting/specialpowers/content/ContentTaskUtils.sys.mjs | 8++------
Mtesting/specialpowers/content/SpecialPowersParent.sys.mjs | 4+---
7 files changed, 16 insertions(+), 49 deletions(-)

diff --git a/browser/extensions/newtab/lib/TelemetryFeed.sys.mjs b/browser/extensions/newtab/lib/TelemetryFeed.sys.mjs @@ -282,9 +282,7 @@ export class TelemetryFeed { } browserOpenNewtabStart() { - // This shim can be removed once Firefox 144 makes it to the release - // channel. - let now = ChromeUtils.now?.() || Cu.now(); + let now = ChromeUtils.now(); this._browserOpenNewtabStart = Math.round(this.processStartTs + now); ChromeUtils.addProfilerMarker( @@ -524,9 +522,7 @@ export class TelemetryFeed { } if (session.perf.visibility_event_rcvd_ts) { - // @backward-compat { version 144 } This newtab train-hop compatibility - // shim can be removed once Firefox 144 makes it to the release channel. - let absNow = this.processStartTs + (ChromeUtils.now?.() || Cu.now()); + let absNow = this.processStartTs + ChromeUtils.now(); session.session_duration = Math.round( absNow - session.perf.visibility_event_rcvd_ts ); diff --git a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.sys.mjs b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.sys.mjs @@ -164,9 +164,7 @@ export var BrowserTestUtils = { * @resolves The new tab. */ openNewForegroundTab(tabbrowser, ...args) { - // This newtab train-hop compatibility shim can be removed once Firefox 144 - // makes it to the release channel. - let startTime = ChromeUtils.now?.() || Cu.now(); + let startTime = ChromeUtils.now(); let options; if ( tabbrowser.ownerGlobal && @@ -362,9 +360,7 @@ export var BrowserTestUtils = { * @resolves The tab switched to. */ switchTab(tabbrowser, tab) { - // This newtab train-hop compatibility shim can be removed once Firefox 144 - // makes it to the release channel. - let startTime = ChromeUtils.now?.() || Cu.now(); + let startTime = ChromeUtils.now(); let { innerWindowId } = tabbrowser.ownerGlobal.windowGlobalChild; // Some tests depend on the delay and TabSwitched only fires if the browser is visible. @@ -447,9 +443,7 @@ export var BrowserTestUtils = { wantLoad = null, maybeErrorPage = false, } = options; - // This newtab train-hop compatibility shim can be removed once Firefox 144 - // makes it to the release channel. - let startTime = ChromeUtils.now?.() || Cu.now(); + let startTime = ChromeUtils.now(); let { innerWindowId } = browser.ownerGlobal.windowGlobalChild; // Passing a url as second argument is a common mistake we should prevent. @@ -1080,9 +1074,7 @@ export var BrowserTestUtils = { * Resolves with the new window once it is loaded. */ async openNewBrowserWindow(options = {}) { - // This newtab train-hop compatibility shim can be removed once Firefox 144 - // makes it to the release channel. - let startTime = ChromeUtils.now?.() || Cu.now(); + let startTime = ChromeUtils.now(); let openerWindow = lazy.BrowserWindowTracker.getTopWindow({ private: false, @@ -1283,9 +1275,7 @@ export var BrowserTestUtils = { * @resolves The Event object. */ waitForEvent(subject, eventName, capture, checkFn, wantsUntrusted) { - // This newtab train-hop compatibility shim can be removed once Firefox 144 - // makes it to the release channel. - let startTime = ChromeUtils.now?.() || Cu.now(); + let startTime = ChromeUtils.now(); let innerWindowId = subject.ownerGlobal?.windowGlobalChild.innerWindowId; return new Promise((resolve, reject) => { @@ -2846,9 +2836,7 @@ export var BrowserTestUtils = { * Extra information to pass to the actor. */ async sendQuery(aBrowsingContext, aMessageName, aMessageData) { - // This newtab train-hop compatibility shim can be removed once Firefox 144 - // makes it to the release channel. - let startTime = ChromeUtils.now?.() || Cu.now(); + let startTime = ChromeUtils.now(); if (!aBrowsingContext.currentWindowGlobal) { await this.waitForCondition(() => aBrowsingContext.currentWindowGlobal); } diff --git a/testing/mochitest/browser-test.js b/testing/mochitest/browser-test.js @@ -1241,9 +1241,7 @@ Tester.prototype = { let currentScope = currentTest.scope; let desc = isSetup ? "setup" : "test"; currentScope.SimpleTest.info(`Entering ${desc} ${task.name}`); - // This newtab train-hop compatibility shim can be removed once Firefox 144 - // makes it to the release channel. - let startTimestamp = ChromeUtils.now?.() || performance.now(); + let startTimestamp = ChromeUtils.now(); let controller = new AbortController(); currentScope.__signal = controller.signal; if (isSetup) { @@ -1472,9 +1470,7 @@ Tester.prototype = { // Import the test script. try { - // This newtab train-hop compatibility shim can be removed once Firefox 144 - // makes it to the release channel. - this.lastStartTimestamp = ChromeUtils.now?.() || performance.now(); + this.lastStartTimestamp = ChromeUtils.now(); this.TestUtils.promiseTestFinished = new Promise(resolve => { this.resolveFinishTestPromise = resolve; }); diff --git a/testing/mochitest/tests/SimpleTest/TestRunner.js b/testing/mochitest/tests/SimpleTest/TestRunner.js @@ -588,10 +588,7 @@ async function _runNextTest() { $("current-test-path").innerHTML = url; - // This newtab train-hop compatibility shim can be removed once Firefox 144 - // makes it to the release channel. - TestRunner._currentTestStartTimestamp = - SpecialPowers.ChromeUtils.now?.() || SpecialPowers.Cu.now(); + TestRunner._currentTestStartTimestamp = SpecialPowers.ChromeUtils.now(); TestRunner._currentTestStartTime = new Date().valueOf(); TestRunner._timeoutFactor = 1; TestRunner._expectedMinAsserts = 0; diff --git a/testing/modules/TestUtils.sys.mjs b/testing/modules/TestUtils.sys.mjs @@ -141,9 +141,7 @@ export var TestUtils = { * @resolves The array [subject, data] from the observed notification. */ topicObserved(topic, checkFn) { - // This newtab train-hop compatibility shim can be removed once Firefox 144 - // makes it to the release channel. - let startTime = ChromeUtils.now?.() || Cu.now(); + let startTime = ChromeUtils.now(); return new Promise((resolve, reject) => { let removed = false; function observer(subject, topic, data) { @@ -288,9 +286,7 @@ export var TestUtils = { * instead. setInterval is not promise-safe. */ waitForCondition(condition, msg, interval = 100, maxTries = 50) { - // This newtab train-hop compatibility shim can be removed once Firefox 144 - // makes it to the release channel. - let startTime = ChromeUtils.now?.() || Cu.now(); + let startTime = ChromeUtils.now(); return new Promise((resolve, reject) => { let tries = 0; let timeoutId = 0; diff --git a/testing/specialpowers/content/ContentTaskUtils.sys.mjs b/testing/specialpowers/content/ContentTaskUtils.sys.mjs @@ -84,9 +84,7 @@ export var ContentTaskUtils = { * Rejects if timeout is exceeded or condition ever throws. */ async waitForCondition(condition, msg, interval = 100, maxTries = 50) { - // This newtab train-hop compatibility shim can be removed once Firefox 144 - // makes it to the release channel. - let startTime = ChromeUtils.now?.() || Cu.now(); + let startTime = ChromeUtils.now(); for (let tries = 0; tries < maxTries; ++tries) { await new Promise(resolve => setTimeout(resolve, interval)); @@ -152,9 +150,7 @@ export var ContentTaskUtils = { */ waitForEvent(subject, eventName, capture, checkFn, wantsUntrusted = false) { return new Promise((resolve, reject) => { - // This newtab train-hop compatibility shim can be removed once Firefox 144 - // makes it to the release channel. - let startTime = ChromeUtils.now?.() || Cu.now(); + let startTime = ChromeUtils.now(); subject.addEventListener( eventName, function listener(event) { diff --git a/testing/specialpowers/content/SpecialPowersParent.sys.mjs b/testing/specialpowers/content/SpecialPowersParent.sys.mjs @@ -850,9 +850,7 @@ export class SpecialPowersParent extends JSWindowActorParent { **/ // eslint-disable-next-line complexity async receiveMessage(aMessage) { - // This newtab train-hop compatibility shim can be removed once Firefox 144 - // makes it to the release channel. - let startTime = ChromeUtils.now?.() || Cu.now(); + let startTime = ChromeUtils.now(); // Try block so we can use a finally statement to add a profiler marker // despite all the return statements. try {