Bug 515664 - when installing an addon, tabs should be restored on restart [r=mbrubeck]
authorMark Finkle <mfinkle@mozilla.com>
Thu, 30 Dec 2010 21:43:08 -0500
changeset 67189 46c24ff8f7fbd025abb7e085ef7a5b721e7b80d7
parent 67188 21528afd3ac4b884760b611c128be99dbee31f4b
child 67190 be6b86b9b5434dcb6b407c82f29ea4978d904c84
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbrubeck
bugs515664
Bug 515664 - when installing an addon, tabs should be restored on restart [r=mbrubeck]
mobile/app/mobile.js
mobile/components/SessionStore.js
--- a/mobile/app/mobile.js
+++ b/mobile/app/mobile.js
@@ -112,16 +112,17 @@ pref("network.autodial-helper.enabled", 
 /* history max results display */
 pref("browser.display.history.maxresults", 100);
 
 /* session history */
 pref("browser.sessionhistory.max_total_viewers", 1);
 pref("browser.sessionhistory.max_entries", 50);
 
 /* session store */
+pref("browser.sessionstore.resume_session_once", false);
 pref("browser.sessionstore.resume_from_crash", true);
 pref("browser.sessionstore.resume_from_crash_timeout", 60); // minutes
 pref("browser.sessionstore.interval", 10000); // milliseconds
 pref("browser.sessionstore.max_tabs_undo", 5);
 
 /* these should help performance */
 pref("mozilla.widget.force-24bpp", true);
 pref("mozilla.widget.use-buffer-pixmap", true);
--- a/mobile/components/SessionStore.js
+++ b/mobile/components/SessionStore.js
@@ -106,16 +106,22 @@ SessionStore.prototype = {
     }
 
     this._interval = Services.prefs.getIntPref("browser.sessionstore.interval");
     this._maxTabsUndo = Services.prefs.getIntPref("browser.sessionstore.max_tabs_undo");
 
     // Disable crash recovery if it has been turned off
     if (!Services.prefs.getBoolPref("browser.sessionstore.resume_from_crash"))
       this._shouldRestore = false;
+
+    // Do we need to restore session just this once, in case of a restart?
+    if (Services.prefs.getBoolPref("browser.sessionstore.resume_session_once")) {
+      Services.prefs.setBoolPref("browser.sessionstore.resume_session_once", false);
+      this._shouldRestore = true;
+    }
   },
   
   observe: function ss_observe(aSubject, aTopic, aData) {
     let self = this;
     let observerService = Services.obs;
     switch (aTopic) {
       case "app-startup": 
         observerService.addObserver(this, "final-ui-startup", true);
@@ -162,16 +168,20 @@ SessionStore.prototype = {
         this._forEachBrowserWindow(function(aWindow) {
           self._collectWindowData(aWindow);
         });
 
         // Freeze the data at what we've got (ignoring closing windows)
         this._loadState = STATE_QUITTING;
         break;
       case "quit-application":
+        // If we are restarting, lets restore the tabs
+        if (aData == "restart")
+          Services.prefs.setBoolPref("browser.sessionstore.resume_session_once", true);
+
         // Freeze the data at what we've got (ignoring closing windows)
         this._loadState = STATE_QUITTING;
 
         // No need for this back up, we are shutting down just fine
         this._sessionFileBackup.remove(false);
 
         observerService.removeObserver(this, "domwindowopened");
         observerService.removeObserver(this, "domwindowclosed");