bug 959399. Make metroFx honor the "show my tabs from last time" startup option. r=mbrubeck. r=jimm. a=bajaj.
authorTim Abraldes <tabraldes@mozilla.com>
Thu, 16 Jan 2014 15:38:12 -0800
changeset 175917 6e306ae9e1cb86e675bc4f105f84adf5582c907d
parent 175916 8a39d0bb4c1f3680136cd11fb165c57583b24b1a
child 175918 748a06e03145ce87b6c21cb0854f3148c09ee6ba
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbrubeck, jimm, bajaj
bugs959399
milestone28.0a2
bug 959399. Make metroFx honor the "show my tabs from last time" startup option. r=mbrubeck. r=jimm. a=bajaj.
browser/metro/base/content/browser.js
browser/metro/profile/metro.js
toolkit/modules/WindowsPrefSync.jsm
--- a/browser/metro/base/content/browser.js
+++ b/browser/metro/base/content/browser.js
@@ -166,18 +166,21 @@ var Browser = {
           self.addTab(activationURI, true, null, { flags: Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP });
         } else {
           let uri = commandURL || Browser.getHomePage();
           self.addTab(uri, true);
         }
       }
 
       // Should we restore the previous session (crash or some other event)
-      let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
-      if (ss.shouldRestore() || Services.prefs.getBoolPref("browser.startup.sessionRestore")) {
+      let ss = Cc["@mozilla.org/browser/sessionstore;1"]
+               .getService(Ci.nsISessionStore);
+      let shouldRestore = ss.shouldRestore()
+                       || (3 == Services.prefs.getIntPref("browser.startup.page"));
+      if (shouldRestore) {
         let bringFront = false;
         // First open any commandline URLs, except the homepage
         if (activationURI && activationURI != kStartURI) {
           this.addTab(activationURI, true, null, { flags: Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP });
         } else if (commandURL && commandURL != kStartURI) {
           this.addTab(commandURL, true);
         } else {
           bringFront = true;
--- a/browser/metro/profile/metro.js
+++ b/browser/metro/profile/metro.js
@@ -128,18 +128,18 @@ pref("browser.firstrun.count", 3);
 // 0 goes Back/Forward
 // 1 act like PgUp/PgDown
 // 2 and other values, nothing
 pref("browser.backspace_action", 0);
 
 /* session history */
 pref("browser.sessionhistory.max_entries", 50);
 
-// On startup, automatically restore tabs from last time?
-pref("browser.startup.sessionRestore", false);
+// On startup, don't automatically restore tabs
+pref("browser.startup.page", 1);
 
 /* session store */
 pref("browser.sessionstore.resume_from_crash", true);
 pref("browser.sessionstore.resume_session_once", false);
 pref("browser.sessionstore.resume_from_crash_timeout", 60); // minutes
 // minimal interval between two save operations in milliseconds
 pref("browser.sessionstore.interval", 15000); // milliseconds
 // maximum amount of POSTDATA to be saved in bytes per history entry (-1 = all of it)
@@ -518,17 +518,16 @@ pref("app.update.cert.checkAttributes", 
 // replace newlines with spaces on paste into single-line text boxes
 pref("editor.singleLine.pasteNewlines", 2);
 
 #ifdef MOZ_SERVICES_SYNC
 // sync service
 pref("services.sync.registerEngines", "Tab,Bookmarks,Form,History,Password,Prefs");
 
 // prefs to sync by default
-pref("services.sync.prefs.sync.browser.startup.sessionRestore", true);
 pref("services.sync.prefs.sync.browser.tabs.warnOnClose", true);
 pref("services.sync.prefs.sync.devtools.errorconsole.enabled", true);
 pref("services.sync.prefs.sync.lightweightThemes.isThemeSelected", true);
 pref("services.sync.prefs.sync.lightweightThemes.usedThemes", true);
 pref("services.sync.prefs.sync.privacy.donottrackheader.enabled", true);
 pref("services.sync.prefs.sync.privacy.donottrackheader.value", true);
 pref("services.sync.prefs.sync.signon.rememberSignons", true);
 #endif
--- a/toolkit/modules/WindowsPrefSync.jsm
+++ b/toolkit/modules/WindowsPrefSync.jsm
@@ -59,22 +59,26 @@ this.WindowsPrefSync = {
    * The following preferences will be pushed to registry from Desktop
    * Firefox and pulled in from Metro Firefox.
    *
    * app.update.* prefs are because Metro shares an installation directory with
    * Firefox, and the options for these are only present in the Desktop options.
    *
    * browser.sessionstore.resume_session_once is mainly for the switch to Metro
    * and switch to Desktop feature.
+   *
+   * browser.startup.page - if a desktop Firefox user wants her/his sessions
+   * to always restore, we need to honor that in metro Firefox as well.
    */
   desktopControlledPrefs: ["app.update.auto",
     "app.update.enabled",
     "app.update.service.enabled",
     "app.update.metro.enabled",
-    "browser.sessionstore.resume_session_once"],
+    "browser.sessionstore.resume_session_once",
+    "browser.startup.page"],
 
   /**
    * Returns the base path where registry sync prefs are stored.
    */
   get prefRegistryPath() {
     let profileService = Cc["@mozilla.org/toolkit/profile-service;1"].
       createInstance(Ci.nsIToolkitProfileService);
     return PREF_BASE_KEY + profileService.selectedProfile.name + "\\";