tor-browser

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

commit 41067c1b92a6c926a7390eb87ce8e2e410cffbdb
parent 33b87c423f86d7f456dd884244ae8c6bdae83973
Author: Mark Banner <standard8@mozilla.com>
Date:   Tue,  9 Dec 2025 15:33:54 +0000

Bug 2004684 - Replace whenTabLoaded in head files with BrowserTestUtils equivalent. r=firefox-desktop-core-reviewers ,Gijs

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

Diffstat:
Mbrowser/base/content/test/about/head.js | 4----
Mbrowser/base/content/test/general/browser_fullscreen-window-open.js | 32+++++++++++++-------------------
Mbrowser/base/content/test/general/head.js | 4----
Mtoolkit/components/contentanalysis/tests/browser/head.js | 4----
4 files changed, 13 insertions(+), 31 deletions(-)

diff --git a/browser/base/content/test/about/head.js b/browser/base/content/test/about/head.js @@ -104,10 +104,6 @@ function waitForCondition(condition, nextTest, errorMsg, retryTimes) { }; } -function whenTabLoaded(aTab, aCallback) { - promiseTabLoadEvent(aTab).then(aCallback); -} - /** * Waits for a load (or custom) event to finish in a given tab. If provided * load an uri into the tab. diff --git a/browser/base/content/test/general/browser_fullscreen-window-open.js b/browser/base/content/test/general/browser_fullscreen-window-open.js @@ -199,26 +199,20 @@ function waitForTabOpen(aOptions) { info("Running test: " + message.title); - let onTabOpen = function onTabOpen(aEvent) { - newBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen, true); - - let tab = aEvent.target; - whenTabLoaded(tab, function () { - is( - tab.linkedBrowser.contentTitle, - message.title, - "Opened Tab is expected: " + message.title - ); - - if (aOptions.successFn) { - aOptions.successFn(); - } + BrowserTestUtils.waitForNewTab(newBrowser, null, true).then(tab => { + is( + tab.linkedBrowser.contentTitle, + message.title, + "Opened Tab is expected: " + message.title + ); + + if (aOptions.successFn) { + aOptions.successFn(); + } - newBrowser.removeTab(tab); - finalize(); - }); - }; - newBrowser.tabContainer.addEventListener("TabOpen", onTabOpen, true); + newBrowser.removeTab(tab); + finalize(); + }); let finalize = function () { aOptions.finalizeFn(); diff --git a/browser/base/content/test/general/head.js b/browser/base/content/test/general/head.js @@ -177,10 +177,6 @@ async function whenNewTabLoaded(aWindow, aCallback) { aCallback(); } -function whenTabLoaded(aTab, aCallback) { - promiseTabLoadEvent(aTab).then(aCallback); -} - /** * Waits for a load (or custom) event to finish in a given tab. If provided * load an uri into the tab. diff --git a/toolkit/components/contentanalysis/tests/browser/head.js b/toolkit/components/contentanalysis/tests/browser/head.js @@ -368,10 +368,6 @@ function makeMockContentAnalysis() { }; } -function whenTabLoaded(aTab, aCallback) { - promiseTabLoadEvent(aTab).then(aCallback); -} - /** * Waits for a load (or custom) event to finish in a given tab. If provided * load an uri into the tab.