Bug 1472599 - Reset browser.startup.page preference for older profiles r=k88hudson a=ritu 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 478134 23bc64507f53b0cba44c72f72539716adcf02d68
parent 478133 db7a4be05d8f51ae46f0f2e5d81b2a7ba97cb17a
child 478135 a55efc9c370fa97c5d65a2ef5bcf494551f482f9
push id9541
push userarchaeopteryx@coole-files.de
push dateThu, 26 Jul 2018 16:18:19 +0000
treeherdermozilla-beta@23bc64507f53 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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,