tor-browser

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

commit 2e5bae3f1beee2be2beed977c85a4afa8f65d3a6
parent c7fdeea1ad250cd497328489dc04d374ea3cb8d9
Author: Dão Gottwald <dao@mozilla.com>
Date:   Sat, 13 Dec 2025 08:00:41 +0000

Bug 2005617 - Remove openSearchPanel feature and adjust UI tour tests to work with the new search bar implementation. r=mbeier

While the legacy search bar allows opening the popup when there are no results, the search bar re-implementation does not. Therefore I think we should remove the openSearchPanel feature which I assume is unused.

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

Diffstat:
Mbrowser/components/uitour/UITour-lib.js | 15---------------
Mbrowser/components/uitour/UITour.sys.mjs | 44++++++++++++--------------------------------
Mbrowser/components/uitour/test/browser.toml | 2--
Mbrowser/components/uitour/test/browser_UITour.js | 4+++-
Dbrowser/components/uitour/test/browser_openSearchPanel.js | 38--------------------------------------
5 files changed, 15 insertions(+), 88 deletions(-)

diff --git a/browser/components/uitour/UITour-lib.js b/browser/components/uitour/UITour-lib.js @@ -322,7 +322,6 @@ if (typeof Mozilla == "undefined") { * * @see Mozilla.UITour.showMenu * @see Mozilla.UITour.hideMenu - * @see Mozilla.UITour.openSearchPanel */ /** @@ -757,20 +756,6 @@ if (typeof Mozilla == "undefined") { }; /** - * @summary Opens the search box's panel. - * - * @description This should have been implemented via `showMenu("search", …)`. - * - * @param {Function} callback - Called once the panel has opened. - * @since 34 - */ - Mozilla.UITour.openSearchPanel = function (callback) { - _sendEvent("openSearchPanel", { - callbackID: _waitForCallback(callback), - }); - }; - - /** * @summary Force the reader mode icon to appear in the address bar regardless of whether * heuristics determine it's appropriate. * diff --git a/browser/components/uitour/UITour.sys.mjs b/browser/components/uitour/UITour.sys.mjs @@ -141,7 +141,9 @@ export var UITour = { { infoPanelOffsetX: 18, infoPanelPosition: "after_start", - query: "#searchbar", + query: Services.prefs.getBoolPref("browser.search.widget.new") + ? "#searchbar-new" + : "#searchbar", widgetName: "search-container", }, ], @@ -149,8 +151,12 @@ export var UITour = { "searchIcon", { query: aDocument => { - let searchbar = aDocument.getElementById("searchbar"); - return searchbar.querySelector(".searchbar-search-button"); + if (!Services.prefs.getBoolPref("browser.search.widget.new")) { + let searchbar = aDocument.getElementById("searchbar"); + return searchbar.querySelector(".searchbar-search-button"); + } + let searchbar = aDocument.getElementById("searchbar-new"); + return searchbar.querySelector(".searchmode-switcher"); }, widgetName: "search-container", }, @@ -552,39 +558,13 @@ export var UITour = { targetPromise.then(target => { let searchbar = target.node; searchbar.value = data.term; - searchbar.updateGoButtonVisibility(); + if (!Services.prefs.getBoolPref("browser.search.widget.new")) { + searchbar.updateGoButtonVisibility(); + } }); break; } - case "openSearchPanel": { - let targetPromise = this.getTarget(window, "search"); - targetPromise - .then(target => { - let searchbar = target.node; - - if (searchbar.textbox.open) { - this.sendPageCallback(browser, data.callbackID); - } else { - let onPopupShown = () => { - searchbar.textbox.popup.removeEventListener( - "popupshown", - onPopupShown - ); - this.sendPageCallback(browser, data.callbackID); - }; - - searchbar.textbox.popup.addEventListener( - "popupshown", - onPopupShown - ); - searchbar.openSuggestionsPanel(); - } - }) - .catch(console.error); - break; - } - case "ping": { if (typeof data.callbackID == "string") { this.sendPageCallback(browser, data.callbackID); diff --git a/browser/components/uitour/test/browser.toml b/browser/components/uitour/test/browser.toml @@ -74,5 +74,3 @@ tags = "os_integration" ["browser_fxa_config.js"] ["browser_openPreferences.js"] - -["browser_openSearchPanel.js"] diff --git a/browser/components/uitour/test/browser_UITour.js b/browser/components/uitour/test/browser_UITour.js @@ -466,7 +466,9 @@ var tests = [ is( popup.anchorNode, - document.getElementById("searchbar"), + Services.prefs.getBoolPref("browser.search.widget.new") + ? document.getElementById("searchbar-new") + : document.getElementById("searchbar"), "Popup should be anchored to the searchbar" ); is(title.textContent, "search title", "Popup should have correct title"); diff --git a/browser/components/uitour/test/browser_openSearchPanel.js b/browser/components/uitour/test/browser_openSearchPanel.js @@ -1,38 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -const { CustomizableUITestUtils } = ChromeUtils.importESModule( - "resource://testing-common/CustomizableUITestUtils.sys.mjs" -); -let gCUITestUtils = new CustomizableUITestUtils(window); - -var gTestTab; -var gContentAPI; - -function test() { - UITourTest(); -} - -var tests = [ - async function test_openSearchPanel(done) { - // If suggestions are enabled, the panel will attempt to use the network to - // connect to the suggestions provider, causing the test suite to fail. We - // also change the preference to display the search bar during the test. - Services.prefs.setBoolPref("browser.search.suggest.enabled", false); - registerCleanupFunction(() => { - gCUITestUtils.removeSearchBar(); - Services.prefs.clearUserPref("browser.search.suggest.enabled"); - }); - - let searchbar = await gCUITestUtils.addSearchBar(); - ok(!searchbar.textbox.popupOpen, "Popup starts as closed"); - gContentAPI.openSearchPanel(() => { - ok(searchbar.textbox.popupOpen, "Popup was opened"); - searchbar.textbox.closePopup(); - ok(!searchbar.textbox.popupOpen, "Popup was closed"); - done(); - }); - }, -];