commit 1e39260629a119a1976c5c6ef8e1cc0176547f4a
parent aed4d375e89cf7a3089bd1be2ffc659ab04f7337
Author: Atila Butkovits <abutkovits@mozilla.com>
Date: Fri, 28 Nov 2025 21:29:28 +0200
Revert "Bug 2002503 - Ensure the unified search button in new windows starts with the default engine favicon. r=urlbar-reviewers,dao" for causing failures complaining about SearchService.sys.mjs.
This reverts commit 39bdffb2ee796525de2c8ecf20ed1f9fef876053.
Diffstat:
3 files changed, 9 insertions(+), 36 deletions(-)
diff --git a/browser/components/urlbar/content/UrlbarInput.mjs b/browser/components/urlbar/content/UrlbarInput.mjs
@@ -420,13 +420,13 @@ export class UrlbarInput extends HTMLElement {
// On startup, this will be called again by browser-init.js
// once gBrowser has been initialized.
this.addGBrowserListeners();
- }
- // If the search service is not initialized yet, the placeholder
- // and icon will be updated in delayedStartupInit.
- if (Services.search.isInitialized) {
- this.searchModeSwitcher.updateSearchIcon();
- this._updatePlaceholderFromDefaultEngine();
+ // If gBrowser or the search service is not initialized yet,
+ // the placeholder and icon will be updated in delayedStartupInit.
+ if (Services.search.isInitialized) {
+ this.searchModeSwitcher.updateSearchIcon();
+ this._updatePlaceholderFromDefaultEngine();
+ }
}
// Expanding requires a parent toolbar, and us not being read-only.
@@ -2498,10 +2498,6 @@ export class UrlbarInput extends HTMLElement {
}
get searchMode() {
- if (!this.window.gBrowser) {
- // This only happens before DOMContentLoaded.
- return null;
- }
return this.getSearchMode(this.window.gBrowser.selectedBrowser);
}
diff --git a/browser/components/urlbar/tests/browser/browser_placeholder.js b/browser/components/urlbar/tests/browser/browser_placeholder.js
@@ -8,10 +8,6 @@
"use strict";
-const { sinon } = ChromeUtils.importESModule(
- "resource://testing-common/Sinon.sys.mjs"
-);
-
const CONFIG = [
{
identifier: "defaultEngine",
@@ -146,10 +142,6 @@ async function doDelayedUpdatePlaceholderTest({ defaultEngine }) {
info("Clear placeholder cache");
Services.prefs.clearUserPref("browser.urlbar.placeholderName");
- info("Pretend we're on startup and the search service hasn't started yet.");
- let stub = sinon.stub(Services.search.wrappedJSObject, "isInitialized");
- stub.get(() => false);
-
info("Open a new window");
let newWin = await BrowserTestUtils.openNewBrowserWindow();
@@ -164,9 +156,6 @@ async function doDelayedUpdatePlaceholderTest({ defaultEngine }) {
"Placeholder data should be unchanged."
);
- info("Pretend the search service has finished initializing.");
- stub.restore();
-
info("Simulate user interaction");
let urlTab = BrowserTestUtils.addTab(newWin.gBrowser, "about:mozilla");
await BrowserTestUtils.switchTab(newWin.gBrowser, urlTab);
diff --git a/browser/components/urlbar/tests/browser/browser_searchModeSwitcher_basic.js b/browser/components/urlbar/tests/browser/browser_searchModeSwitcher_basic.js
@@ -268,19 +268,6 @@ async function setDefaultEngine(name) {
);
}
-add_task(async function test_icon_new_window() {
- let newWin = await BrowserTestUtils.openNewBrowserWindow();
- let expectedIcon = await Services.search.defaultEngine.getIconURL();
-
- Assert.equal(
- await getSearchModeSwitcherIcon(newWin),
- expectedIcon,
- "The search mode switcher should already have the engine favicon."
- );
-
- await BrowserTestUtils.closeWindow(newWin);
-});
-
add_task(async function test_search_icon_change() {
await SpecialPowers.pushPrefEnv({
set: [["keyword.enabled", false]],
@@ -288,11 +275,12 @@ add_task(async function test_search_icon_change() {
let newWin = await BrowserTestUtils.openNewBrowserWindow();
const globeIconUrl = UrlbarUtils.ICON.GLOBE;
+ const searchIconUrl = UrlbarUtils.ICON.SEARCH_GLASS;
Assert.equal(
await getSearchModeSwitcherIcon(newWin),
- globeIconUrl,
- "The search mode switcher should have the globe icon url since keyword.enabled is false"
+ searchIconUrl,
+ "The search mode switcher should have the default (search icon) url since we are not in search mode."
);
let popup = UrlbarTestUtils.searchModeSwitcherPopup(newWin);