Bug 951725: Notify sessionstore of browser restart in order to save session state. r=ttaubert a=lsblakk
authorMarina Samuel <msamuel@mozilla.com>
Wed, 18 Dec 2013 15:28:40 -0500
changeset 174475 440cc338dc726edfe4ff798e64e5725f281b23cd
parent 174474 f0c13a12ef1cc460fdcf42a16949abf5a4a251a8
child 174476 ea0884724339210927a68f860fb510b5e70cee27
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersttaubert, lsblakk
bugs951725
milestone28.0a2
Bug 951725: Notify sessionstore of browser restart in order to save session state. r=ttaubert a=lsblakk
browser/base/content/browser.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -2512,18 +2512,25 @@ function _checkDefaultAndSwitchToMetro()
     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);
+
+    let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
+                     .createInstance(Ci.nsISupportsPRBool);
+    Services.obs.notifyObservers(cancelQuit, "quit-application-requested", "restart");
+
+    if (!cancelQuit.data) {
+      appStartup.quit(Components.interfaces.nsIAppStartup.eAttemptQuit |
+                      Components.interfaces.nsIAppStartup.eRestartTouchEnvironment);
+    }
     return true;
   }
   return false;
 #endif
 #endif
 #endif
 }