tor-browser

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

commit 1e97ee63cddff46fa6f5bfb2ba84cc17022ba07d
parent cc91e0bec3f57d837865893a05108403f67acae3
Author: Mark Banner <standard8@mozilla.com>
Date:   Fri, 12 Dec 2025 14:18:21 +0000

Bug 2005316 - Replace SearchUIUtils.loadSearchFromCommandLine with SearchUIUtils.loadSearch. r=search-reviewers,firefox-desktop-core-reviewers ,scunnane,mossop

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

Diffstat:
Mbrowser/components/BrowserContentHandler.sys.mjs | 18++++++++++--------
Mbrowser/components/search/SearchUIUtils.sys.mjs | 33---------------------------------
Mbrowser/components/search/test/browser/telemetry/browser_search_telemetry_sources.js | 13+++++++------
3 files changed, 17 insertions(+), 47 deletions(-)

diff --git a/browser/components/BrowserContentHandler.sys.mjs b/browser/components/BrowserContentHandler.sys.mjs @@ -369,7 +369,7 @@ function openPreferences(cmdLine) { openBrowserWindow(cmdLine, lazy.gSystemPrincipal, "about:preferences"); } -async function doSearch(searchTerm, cmdLine) { +async function doSearch(searchText, cmdLine) { // XXXbsmedberg: use handURIToExistingBrowser to obey tabbed-browsing // preferences, but need nsIBrowserDOMWindow extensions // Open the window immediately as BrowserContentHandler needs to @@ -381,14 +381,16 @@ async function doSearch(searchTerm, cmdLine) { subject => subject == win ); - lazy.SearchUIUtils.loadSearchFromCommandLine( - win, - searchTerm, - lazy.PrivateBrowsingUtils.isInTemporaryAutoStartMode || + lazy.SearchUIUtils.loadSearch({ + window: win, + searchText, + usePrivate: + lazy.PrivateBrowsingUtils.isInTemporaryAutoStartMode || lazy.PrivateBrowsingUtils.isWindowPrivate(win), - lazy.gSystemPrincipal, - win.gBrowser.selectedBrowser.policyContainer - ).catch(console.error); + triggeringPrincipal: lazy.gSystemPrincipal, + policyContainer: win.gBrowser.selectedBrowser.policyContainer, + sapSource: "system", + }).catch(console.error); } function spinForLastUpdateInstalled() { diff --git a/browser/components/search/SearchUIUtils.sys.mjs b/browser/components/search/SearchUIUtils.sys.mjs @@ -521,37 +521,4 @@ export var SearchUIUtils = { : "contextmenu", }); }, - - /** - * Perform a search initiated from the command line. - * - * @param {WindowProxy} window - * The window where the search was triggered. - * @param {string} searchText - * The search terms to use for the search. - * @param {boolean} usePrivate - * Whether to use the Private Browsing mode default search engine. - * Defaults to `false`. - * @param {nsIPrincipal} triggeringPrincipal - * The principal to use for a new window or tab. - * @param {nsIPolicyContainer} policyContainer - * The policyContainer to use for a new window or tab. - */ - async loadSearchFromCommandLine( - window, - searchText, - usePrivate, - triggeringPrincipal, - policyContainer - ) { - return SearchUIUtils.loadSearch({ - window, - searchText, - where: "current", - usePrivate, - triggeringPrincipal, - policyContainer, - sapSource: "system", - }); - }, }; diff --git a/browser/components/search/test/browser/telemetry/browser_search_telemetry_sources.js b/browser/components/search/test/browser/telemetry/browser_search_telemetry_sources.js @@ -440,13 +440,14 @@ add_task(async function test_source_system() { // This is not quite the same as calling from the commandline, but close // enough for this test. - SearchUIUtils.loadSearchFromCommandLine( + SearchUIUtils.loadSearch({ window, - "searchSuggestion", - false, - Services.scriptSecurityManager.getSystemPrincipal(), - gBrowser.selectedBrowser.policyContainer - ); + searchText: "searchSuggestion", + triggeringPrincipal: + Services.scriptSecurityManager.getSystemPrincipal(), + policyContainer: gBrowser.selectedBrowser.policyContainer, + sapSource: "system", + }); await loadPromise; return tab;