commit d156ec1e68675ed4b800759cf9610ebb3af92a6d
parent d4982db83833b06744268f75aee911be5b2ebc96
Author: dadaa <daisuke.akatsuka@birchill.co.jp>
Date: Tue, 7 Oct 2025 00:14:40 +0000
Bug 1961568: Handle about:newtab and about:privatebrowsing as blank page always r=adw
Differential Revision: https://phabricator.services.mozilla.com/D250532
Diffstat:
2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/browser/base/content/utilityOverlay.js b/browser/base/content/utilityOverlay.js
@@ -78,7 +78,8 @@ function isBlankPageURL(aURL) {
return (
aURL == "about:blank" ||
aURL == "about:home" ||
- aURL == BROWSER_NEW_TAB_URL ||
+ aURL == AboutNewTab.newTabURL ||
+ aURL == "about:privatebrowsing" ||
aURL == "chrome://browser/content/blanktab.html"
);
}
diff --git a/browser/components/urlbar/tests/browser/browser_searchModeSwitcher_dynamicUnifiedSearchButton.js b/browser/components/urlbar/tests/browser/browser_searchModeSwitcher_dynamicUnifiedSearchButton.js
@@ -134,6 +134,40 @@ add_task(async function test_button_visibility_by_tab_switching() {
BrowserTestUtils.removeTab(tab);
});
+add_task(async function test_button_visibility_by_navigate_blank_page() {
+ const BLANK_PAGE_URLS = [
+ "about:blank",
+ "about:home",
+ "about:newtab",
+ "about:privatebrowsing",
+ ];
+
+ for (let isPrivateMode of [false, true]) {
+ for (let url of BLANK_PAGE_URLS) {
+ info(`Test for ${url} in private mode: ${isPrivateMode}`);
+
+ info("Open pageproxystate valid page");
+ let tab = await BrowserTestUtils.openNewForegroundTab(
+ gBrowser,
+ "https://example.com/"
+ );
+ await assertState(false, "valid");
+
+ info("Navigate to blank page");
+ let onLocationChange = BrowserTestUtils.waitForLocationChange(
+ gBrowser,
+ url
+ );
+ gURLBar.value = url;
+ gURLBar.focus();
+ EventUtils.synthesizeKey("KEY_Enter");
+ await onLocationChange;
+ await assertState(true, "invalid");
+ BrowserTestUtils.removeTab(tab);
+ }
+ }
+});
+
async function assertState(expectedVisible, expectedProxyPageState) {
let switcher = document.getElementById("urlbar-searchmode-switcher");
await BrowserTestUtils.waitForCondition(() => {