Bug 1322719 - treat about:newtab like about:home in our UI when it's the default, r?dao
MozReview-Commit-ID: DFn7ZZF2dXw
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -5302,17 +5302,17 @@ var gHomeButton = {
updateTooltip: function(homeButton)
{
if (!homeButton)
homeButton = document.getElementById("home-button");
if (homeButton) {
var homePage = this.getHomePage();
homePage = homePage.replace(/\|/g, ', ');
- if (homePage.toLowerCase() == "about:home")
+ if (["about:home", "about:newtab"].includes(homePage.toLowerCase()))
homeButton.setAttribute("tooltiptext", homeButton.getAttribute("aboutHomeOverrideTooltip"));
else
homeButton.setAttribute("tooltiptext", homePage);
}
},
getHomePage: function()
{
--- a/browser/components/preferences/in-content/main.js
+++ b/browser/components/preferences/in-content/main.js
@@ -240,20 +240,27 @@ var gMainPane = {
* selected and doesn't change the UI for this preference, the deprecated
* option is preserved.
*/
syncFromHomePref: function()
{
let homePref = document.getElementById("browser.startup.homepage");
- // If the pref is set to about:home, set the value to "" to show the
- // placeholder text (about:home title).
- if (homePref.value.toLowerCase() == "about:home")
+ // If the pref is set to about:home or about:newtab, set the value to ""
+ // to show the placeholder text (about:home title) rather than
+ // exposing those URLs to users.
+ let defaultBranch = Services.prefs.getDefaultBranch("");
+ let defaultValue = defaultBranch.getComplexValue("browser.startup.homepage",
+ Ci.nsIPrefLocalizedString).data;
+ let currentValue = homePref.value.toLowerCase();
+ if (currentValue == "about:home" ||
+ (currentValue == defaultValue && currentValue == "about:newtab")) {
return "";
+ }
// If the pref is actually "", show about:blank. The actual home page
// loading code treats them the same, and we don't want the placeholder text
// to be shown.
if (homePref.value == "")
return "about:blank";
// Otherwise, show the actual pref value.