From 59d03e0b1d905d739387843d3bd2c0f5aeeb212f Mon Sep 17 00:00:00 2001 From: Butkovits Atila Date: Tue, 30 Aug 2022 20:56:51 +0300 Subject: [PATCH] Backed out 2 changesets (bug 1676492) for causing failures at test_navigation.py. CLOSED TREE Backed out changeset 09fd88048f35 (bug 1676492) Backed out changeset bc76e6966ec9 (bug 1676492) --- browser/actors/AboutNewTabChild.jsm | 4 ---- browser/base/content/blanktab.html | 11 --------- browser/base/content/browser.js | 5 +--- .../browser_aboutNewTab_bookmarksToolbar.js | 21 +++------------- browser/base/content/utilityOverlay.js | 3 +-- browser/base/jar.mn | 1 - browser/components/about/AboutRedirector.cpp | 2 +- .../browser/browser_policy_set_startpage.js | 2 +- .../browser/browser_enabled_newtabpage.js | 24 +++++++------------ browser/components/preferences/home.js | 17 ++++--------- .../preferences/tests/browser_bug1579418.js | 7 ------ browser/modules/HomePage.jsm | 4 ---- 12 files changed, 20 insertions(+), 81 deletions(-) delete mode 100644 browser/base/content/blanktab.html diff --git a/browser/actors/AboutNewTabChild.jsm b/browser/actors/AboutNewTabChild.jsm index 32484ed125f4..a15ad2b02449 100644 --- a/browser/actors/AboutNewTabChild.jsm +++ b/browser/actors/AboutNewTabChild.jsm @@ -33,10 +33,6 @@ XPCOMUtils.defineLazyPreferenceGetter( class AboutNewTabChild extends JSWindowActorChild { handleEvent(event) { if (event.type == "DOMContentLoaded") { - if (!this.contentWindow.document.body.firstElementChild) { - return; // about:newtab is a blank page - } - // If the separate about:welcome page is enabled, we can skip all of this, // since that mode doesn't load any of the Activity Stream bits. if ( diff --git a/browser/base/content/blanktab.html b/browser/base/content/blanktab.html deleted file mode 100644 index 49d4851bf860..000000000000 --- a/browser/base/content/blanktab.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 4b9a0426bc82..1f2ab4312d17 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -649,7 +649,6 @@ var gInitialPages = [ "about:sessionrestore", "about:welcome", "about:welcomeback", - "chrome://browser/content/blanktab.html", ]; function isInitialPage(url) { @@ -6744,9 +6743,7 @@ function setToolbarVisibility( } } isVisible = - !!currentURI && - (BookmarkingUI.isOnNewTabPage({ currentURI }) || - currentURI?.spec == "chrome://browser/content/blanktab.html"); + !!currentURI && BookmarkingUI.isOnNewTabPage({ currentURI }); break; } } diff --git a/browser/base/content/test/about/browser_aboutNewTab_bookmarksToolbar.js b/browser/base/content/test/about/browser_aboutNewTab_bookmarksToolbar.js index a0d7d5af59be..ae595271ad36 100644 --- a/browser/base/content/test/about/browser_aboutNewTab_bookmarksToolbar.js +++ b/browser/base/content/test/about/browser_aboutNewTab_bookmarksToolbar.js @@ -247,10 +247,6 @@ add_task(async function test_with_newtabpage_disabled() { visible: true, message: "Toolbar is visible with NTP enabled", }); - let firstid = await SpecialPowers.spawn(newtab.linkedBrowser, [], () => { - return content.document.body.firstElementChild?.id; - }); - is(firstid, "root", "new tab page contains content"); await BrowserTestUtils.removeTab(newtab); await SpecialPowers.pushPrefEnv({ @@ -260,22 +256,11 @@ add_task(async function test_with_newtabpage_disabled() { document.getElementById("cmd_newNavigatorTab").doCommand(); await TestUtils.waitForCondition(() => gBrowser.tabs.length == tabCount + 1); newtab = gBrowser.selectedTab; - + is(newtab.linkedBrowser.currentURI.spec, "about:blank", "blank is loaded"); await waitForBookmarksToolbarVisibility({ - visible: true, - message: "Toolbar is visible with NTP disabled", + visible: false, + message: "Toolbar is not visible with NTP disabled", }); - - is( - newtab.linkedBrowser.currentURI.spec, - "about:newtab", - "blank new tab is loaded" - ); - firstid = await SpecialPowers.spawn(newtab.linkedBrowser, [], () => { - return content.document.body.firstElementChild; - }); - ok(!firstid, "blank new tab page contains no content"); - await BrowserTestUtils.removeTab(newtab); await SpecialPowers.pushPrefEnv({ diff --git a/browser/base/content/utilityOverlay.js b/browser/base/content/utilityOverlay.js index 2b0c9010f041..db730d8baec5 100644 --- a/browser/base/content/utilityOverlay.js +++ b/browser/base/content/utilityOverlay.js @@ -76,8 +76,7 @@ function isBlankPageURL(aURL) { aURL == "about:blank" || aURL == "about:home" || aURL == "about:welcome" || - aURL == BROWSER_NEW_TAB_URL || - aURL == "chrome://browser/content/blanktab.html" + aURL == BROWSER_NEW_TAB_URL ); } diff --git a/browser/base/jar.mn b/browser/base/jar.mn index f8841587f4b1..8dfe4815a5af 100644 --- a/browser/base/jar.mn +++ b/browser/base/jar.mn @@ -35,7 +35,6 @@ browser.jar: content/browser/aboutTabCrashed.css (content/aboutTabCrashed.css) content/browser/aboutTabCrashed.js (content/aboutTabCrashed.js) content/browser/aboutTabCrashed.xhtml (content/aboutTabCrashed.xhtml) - content/browser/blanktab.html (content/blanktab.html) content/browser/browser.css (content/browser.css) content/browser/browser.js (content/browser.js) * content/browser/browser.xhtml (content/browser.xhtml) diff --git a/browser/components/about/AboutRedirector.cpp b/browser/components/about/AboutRedirector.cpp index ca9c48b65fa6..ce25ab082af7 100644 --- a/browser/components/about/AboutRedirector.cpp +++ b/browser/components/about/AboutRedirector.cpp @@ -100,7 +100,7 @@ static const RedirEntry kRedirMap[] = { // Actual activity stream URL for home and newtab are set in channel // creation {"home", "about:blank", ACTIVITY_STREAM_FLAGS}, - {"newtab", "chrome://browser/content/blanktab.html", ACTIVITY_STREAM_FLAGS}, + {"newtab", "about:blank", ACTIVITY_STREAM_FLAGS}, {"welcome", "about:blank", nsIAboutModule::URI_MUST_LOAD_IN_CHILD | nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS | diff --git a/browser/components/enterprisepolicies/tests/browser/browser_policy_set_startpage.js b/browser/components/enterprisepolicies/tests/browser/browser_policy_set_startpage.js index 72bc87e8d669..36636b349491 100644 --- a/browser/components/enterprisepolicies/tests/browser/browser_policy_set_startpage.js +++ b/browser/components/enterprisepolicies/tests/browser/browser_policy_set_startpage.js @@ -51,7 +51,7 @@ add_task(async function homepage_test_startpage_none() { }, }); await check_homepage({ - expectedURL: "chrome://browser/content/blanktab.html", + expectedURL: "about:blank", expectedPageVal: 1, }); }); diff --git a/browser/components/newtab/test/browser/browser_enabled_newtabpage.js b/browser/components/newtab/test/browser/browser_enabled_newtabpage.js index 8762160cb1bb..1c003198edec 100644 --- a/browser/components/newtab/test/browser/browser_enabled_newtabpage.js +++ b/browser/components/newtab/test/browser/browser_enabled_newtabpage.js @@ -1,33 +1,25 @@ -function getSpec(uri) { +function checkSpec(uri, check, message) { const { spec } = NetUtil.newChannel({ loadUsingSystemPrincipal: true, uri, }).URI; info(`got ${spec} for ${uri}`); - return spec; + check(spec, "about:blank", message); } add_task(async function test_newtab_enabled() { - ok( - !getSpec("about:newtab").endsWith("/blanktab.html"), + checkSpec( + "about:newtab", + isnot, "did not get blank for default about:newtab" ); - ok( - !getSpec("about:home").endsWith("/blanktab.html"), - "did not get blank for default about:home" - ); + checkSpec("about:home", isnot, "did not get blank for default about:home"); await SpecialPowers.pushPrefEnv({ set: [["browser.newtabpage.enabled", false]], }); - ok( - getSpec("about:newtab").endsWith("/blanktab.html"), - "got special blank page when newtab is not enabled" - ); - ok( - !getSpec("about:home").endsWith("/blanktab.html"), - "got special blank page for about:home" - ); + checkSpec("about:newtab", is, "got blank when newtab is not enabled"); + checkSpec("about:home", isnot, "still did not get blank for about:home"); }); diff --git a/browser/components/preferences/home.js b/browser/components/preferences/home.js index 54d960ec95e4..9810f9379ff0 100644 --- a/browser/components/preferences/home.js +++ b/browser/components/preferences/home.js @@ -32,8 +32,6 @@ const HOMEPAGE_OVERRIDE_KEY = "homepage_override"; const URL_OVERRIDES_TYPE = "url_overrides"; const NEW_TAB_KEY = "newTabURL"; -const BLANK_HOMEPAGE_URL = "chrome://browser/content/blanktab.html"; - var gHomePane = { HOME_MODE_FIREFOX_HOME: "0", HOME_MODE_BLANK: "1", @@ -102,8 +100,7 @@ var gHomePane = { // If the new tab url was changed to about:blank or about:newtab if ( AboutNewTab.newTabURL === "about:newtab" || - AboutNewTab.newTabURL === "about:blank" || - AboutNewTab.newTabURL === BLANK_HOMEPAGE_URL + AboutNewTab.newTabURL === "about:blank" ) { let newtabEnabledPref = Services.prefs.getBoolPref( this.NEWTAB_ENABLED_PREF, @@ -308,7 +305,7 @@ var gHomePane = { // (and it makes existing tests happy). let newValue; if ( - this._isBlankPage(homePage) || + homePage === "about:blank" || (HomePage.isDefault && !HomePage.locked) ) { newValue = ""; @@ -338,7 +335,7 @@ var gHomePane = { isHomePageBlank() { const startupPref = Preferences.get("browser.startup.page"); return ( - ["about:blank", BLANK_HOMEPAGE_URL, ""].includes(HomePage.get()) || + ["about:blank", ""].includes(HomePage.get()) || startupPref.value === gMainPane.STARTUP_PREF_BLANK ); }, @@ -475,8 +472,8 @@ var gHomePane = { } break; case this.HOME_MODE_BLANK: - if (!this._isBlankPage(HomePage.get())) { - HomePage.safeSet(BLANK_HOMEPAGE_URL); + if (HomePage.get() !== "about:blank") { + HomePage.safeSet("about:blank"); } else { this._renderCustomSettings({ shouldShow: false }); } @@ -624,10 +621,6 @@ var gHomePane = { ); }, - _isBlankPage(url) { - return url == "about:blank" || url == BLANK_HOMEPAGE_URL; - }, - /** * Show the Restore Defaults button if any preference on the Home tab was * changed, or hide it otherwise. diff --git a/browser/components/preferences/tests/browser_bug1579418.js b/browser/components/preferences/tests/browser_bug1579418.js index a179ae9936c6..7dd89ba21463 100644 --- a/browser/components/preferences/tests/browser_bug1579418.js +++ b/browser/components/preferences/tests/browser_bug1579418.js @@ -18,8 +18,6 @@ add_task(async function default_homepage_test() { homeMode.dispatchEvent(new Event("command")); - is(Services.prefs.getCharPref("browser.startup.homepage"), "about:home"); - // HOME_MODE_BLANK homeMode.value = 1; @@ -30,11 +28,6 @@ add_task(async function default_homepage_test() { "Wait for customSettings to be hidden." ); - is( - Services.prefs.getCharPref("browser.startup.homepage"), - "chrome://browser/content/blanktab.html" - ); - // HOME_MODE_CUSTOM homeMode.value = 2; diff --git a/browser/modules/HomePage.jsm b/browser/modules/HomePage.jsm index f4403a3128d1..fd2a463c9e8c 100644 --- a/browser/modules/HomePage.jsm +++ b/browser/modules/HomePage.jsm @@ -136,10 +136,6 @@ let HomePage = { } } - if (homePages == "about:blank") { - homePages = "chrome://browser/content/blanktab.html"; - } - return homePages; },