Bug 1322720 - don't show the homepage on firstrun if a pref is flipped, r=dao draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Thu, 15 Dec 2016 15:40:50 +0000
changeset 450345 4f214431322cd1fb8b39c0f4a2b873dbce8ff593
parent 449949 c750a7de1194d71f2d2ef73f6a919d26b9640cae
child 539735 9241c4cb680b5905d731ba5be6a52c829b9e42be
push id38839
push userbmo:gijskruitbosch+bugs@gmail.com
push dateFri, 16 Dec 2016 11:25:36 +0000
reviewersdao
bugs1322720
milestone53.0a1
Bug 1322720 - don't show the homepage on firstrun if a pref is flipped, r=dao MozReview-Commit-ID: FhWyo7omun3
browser/app/profile/firefox.js
browser/components/nsBrowserContentHandler.js
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -211,16 +211,18 @@ pref("browser.shell.shortcutFavicons",tr
 pref("browser.shell.mostRecentDateSetAsDefault", "");
 pref("browser.shell.skipDefaultBrowserCheck", true);
 pref("browser.shell.defaultBrowserCheckCount", 0);
 
 // 0 = blank, 1 = home (browser.startup.homepage), 2 = last visited page, 3 = resume previous browser session
 // The behavior of option 3 is detailed at: http://wiki.mozilla.org/Session_Restore
 pref("browser.startup.page",                1);
 pref("browser.startup.homepage",            "chrome://branding/locale/browserconfig.properties");
+// Whether we should skip the homepage when opening the first-run page
+pref("browser.startup.firstrunSkipsHomepage", false);
 
 pref("browser.slowStartup.notificationDisabled", false);
 pref("browser.slowStartup.timeThreshold", 40000);
 pref("browser.slowStartup.maxSamples", 5);
 
 // This url, if changed, MUST continue to point to an https url. Pulling arbitrary content to inject into
 // this page over http opens us up to a man-in-the-middle attack that we'd rather not face. If you are a downstream
 // repackager of this code using an alternate snippet url, please keep your users safe
--- a/browser/components/nsBrowserContentHandler.js
+++ b/browser/components/nsBrowserContentHandler.js
@@ -546,18 +546,21 @@ nsBrowserContentHandler.prototype = {
         startPage = this.startPage;
     } catch (e) {
       Components.utils.reportError(e);
     }
 
     if (startPage == "about:blank")
       startPage = "";
 
-    // Only show the startPage if we're not restoring an update session.
-    if (overridePage && startPage && !willRestoreSession)
+    let skipStartPage = override == OVERRIDE_NEW_PROFILE &&
+      prefb.getBoolPref("browser.startup.firstrunSkipsHomepage");
+    // Only show the startPage if we're not restoring an update session and are
+    // not set to skip the start page on this profile
+    if (overridePage && startPage && !willRestoreSession && !skipStartPage)
       return overridePage + "|" + startPage;
 
     return overridePage || startPage || "about:blank";
   },
 
   get startPage() {
     var uri = Services.prefs.getComplexValue("browser.startup.homepage",
                                              nsIPrefLocalizedString).data;