Bug 1472599 - Reset browser.startup.page preference for older profiles r=k88hudson a=ritu draft DEVEDITION_62_0b12_BUILD1 DEVEDITION_62_0b12_RELEASE FIREFOX_62_0b12_BUILD1 FIREFOX_62_0b12_RELEASE
authorAndrei Oprea <andrei.br92@gmail.com>
Wed, 18 Jul 2018 14:22:47 +0200
changeset 824990 23bc64507f53b0cba44c72f72539716adcf02d68
parent 824989 db7a4be05d8f51ae46f0f2e5d81b2a7ba97cb17a
child 824991 a55efc9c370fa97c5d65a2ef5bcf494551f482f9
push id118017
push userbmo:edilee@mozilla.com
push dateTue, 31 Jul 2018 21:53:17 +0000
reviewersk88hudson, ritu
bugs1472599
milestone62.0
Bug 1472599 - Reset browser.startup.page preference for older profiles r=k88hudson a=ritu MozReview-Commit-ID: LpzKJYxty1K
browser/components/preferences/in-content/home.js
--- a/browser/components/preferences/in-content/home.js
+++ b/browser/components/preferences/in-content/home.js
@@ -248,16 +248,19 @@ let gHomePane = {
       case this.HOME_MODE_BLANK:
         if (homePref.value !== "about:blank") {
           homePref.value = "about:blank";
         } else {
           this._renderCustomSettings({shouldShow: false});
         }
         break;
       case this.HOME_MODE_CUSTOM:
+        if (startupPref.value === gMainPane.STARTUP_PREF_BLANK) {
+          Services.prefs.clearUserPref(startupPref.id);
+        }
         this._renderCustomSettings({shouldShow: true});
         break;
     }
   },
 
   /**
    * Switches the "Use Current Page" button between its singular and plural
    * forms.
@@ -321,20 +324,18 @@ let gHomePane = {
     const rv = { urls: null, names: null };
     gSubDialog.open("chrome://browser/content/preferences/selectBookmark.xul",
       "resizable=yes, modal=yes", rv,
       this._setHomePageToBookmarkClosed.bind(this, rv));
     Services.telemetry.scalarAdd("preferences.use_bookmark", 1);
   },
 
   restoreDefaultHomePage() {
-    const homePref = Preferences.get("browser.startup.homepage");
-    const newtabPref = Preferences.get(this.NEWTAB_ENABLED_PREF);
-    homePref.value = homePref.defaultValue;
-    newtabPref.value = newtabPref.defaultValue;
+    Services.prefs.clearUserPref("browser.startup.homepage");
+    Services.prefs.clearUserPref(this.NEWTAB_ENABLED_PREF);
   },
 
   onCustomHomePageInput(event) {
     if (this._telemetryHomePageTimer) {
       clearTimeout(this._telemetryHomePageTimer);
     }
     let browserHomePage = event.target.value;
     // The length of the home page URL string should be more then four,