Bug 931798 - Restore session after a switch to desktop/metro happens. r=emtwo
authorBrian R. Bondy <netzen@gmail.com>
Tue, 19 Nov 2013 13:18:20 -0500
changeset 158064 fb3ae66def36f3781fed5d4d819f07c279912ca0
parent 158063 ef5ef338cfcf733f8b35d73690915a672a848c98
child 158065 5257899d8b21d416137402dfa3bb485437c6574a
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersemtwo
bugs931798
milestone28.0a1
Bug 931798 - Restore session after a switch to desktop/metro happens. r=emtwo
browser/base/content/browser.js
browser/metro/base/content/appbar.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -2467,16 +2467,17 @@ function _checkDefaultAndSwitchToMetro()
   let shell = Components.classes["@mozilla.org/browser/shell-service;1"].
     getService(Components.interfaces.nsIShellService);
   let isDefault = shell.isDefaultBrowser(false, false);
 
   if (isDefault) {
     let appStartup = Components.classes["@mozilla.org/toolkit/app-startup;1"].
     getService(Components.interfaces.nsIAppStartup);
 
+    Services.prefs.setBoolPref('browser.sessionstore.resume_session_once', true);
     appStartup.quit(Components.interfaces.nsIAppStartup.eAttemptQuit |
                     Components.interfaces.nsIAppStartup.eRestartTouchEnvironment);
     return true;
   }
   return false;
 #endif
 #endif
 #endif
@@ -4687,17 +4688,18 @@ function fireSidebarFocusedEvent() {
 /**
  * Some prefs that have consequences in both Metro and Desktop such as
  * app-update prefs, are automatically pushed from Desktop here for use
  * in Metro.
  */
 var gMetroPrefs = {
   prefDomain: ["app.update.auto", "app.update.enabled",
                "app.update.service.enabled",
-               "app.update.metro.enabled"],
+               "app.update.metro.enabled",
+               "browser.sessionstore.resume_session_once"],
   observe: function (aSubject, aTopic, aPrefName)
   {
     if (aTopic != "nsPref:changed")
       return;
 
     this.pushDesktopControlledPrefToMetro(aPrefName);
   },
 
--- a/browser/metro/base/content/appbar.js
+++ b/browser/metro/base/content/appbar.js
@@ -142,16 +142,17 @@ var Appbar = {
 
       });
   },
 
   onViewOnDesktop: function() {
     let appStartup = Components.classes["@mozilla.org/toolkit/app-startup;1"].
       getService(Components.interfaces.nsIAppStartup);
 
+    Services.prefs.setBoolPref('browser.sessionstore.resume_session_once', true);
     appStartup.quit(Components.interfaces.nsIAppStartup.eAttemptQuit |
                     Components.interfaces.nsIAppStartup.eRestart);
   },
 
   onAutocompleteCloseButton: function () {
     Elements.autocomplete.closePopup();
   },