tor-browser

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

commit 2a6a03febc07f0faae415cdd540c56ccc2261822
parent 66480eb6aeb2b7fccd6237d082f8adcd6867c6f5
Author: Mark Banner <standard8@mozilla.com>
Date:   Tue,  6 Jan 2026 22:24:36 +0000

Bug 2008745 - Stop leaking globals into the global scope from imports in autocomplete-popup.js. r=search-reviewers,scunnane

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

Diffstat:
Mbrowser/components/search/content/autocomplete-popup.js | 11+++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/browser/components/search/content/autocomplete-popup.js b/browser/components/search/content/autocomplete-popup.js @@ -6,7 +6,8 @@ // Wrap in a block to prevent leaking to window scope. { - ChromeUtils.defineESModuleGetters(this, { + const lazy = {}; + ChromeUtils.defineESModuleGetters(lazy, { BrowserSearchTelemetry: "moz-src:///browser/components/search/BrowserSearchTelemetry.sys.mjs", BrowserUtils: "resource://gre/modules/BrowserUtils.sys.mjs", @@ -101,7 +102,9 @@ this._searchOneOffsContainer = this.querySelector(".search-one-offs"); this._searchbarEngine = this.querySelector(".search-panel-header"); this._searchbarEngineName = this.querySelector(".searchbar-engine-name"); - this._oneOffButtons = new SearchOneOffs(this._searchOneOffsContainer); + this._oneOffButtons = new lazy.SearchOneOffs( + this._searchOneOffsContainer + ); this._searchbar = document.getElementById("searchbar"); } @@ -191,7 +194,7 @@ } // Check for middle-click or modified clicks on the search bar - BrowserSearchTelemetry.recordSearchSuggestionSelectionMethod( + lazy.BrowserSearchTelemetry.recordSearchSuggestionSelectionMethod( aEvent, this.selectedIndex ); @@ -200,7 +203,7 @@ let search = this.input.controller.getValueAt(this.selectedIndex); // open the search results according to the clicking subtlety - let where = BrowserUtils.whereToOpenLink(aEvent, false, true); + let where = lazy.BrowserUtils.whereToOpenLink(aEvent, false, true); let params = {}; // But open ctrl/cmd clicks on autocomplete items in a new background tab.