Bug 951725: Notify sessionstore of browser restart in order to save session state. r=ttaubert
authorMarina Samuel <msamuel@mozilla.com>
Wed, 18 Dec 2013 15:28:40 -0500
changeset 161110 9ef88383852a66a40e48318b3a88b9e199ddb866
parent 161109 2de2620d564a2cc3b6fb1a8367543991add6555c
child 161111 308fea805085189e87d034af5b958788e805158d
push id25867
push userryanvm@gmail.com
push dateThu, 19 Dec 2013 02:19:33 +0000
treeherdermozilla-central@04a70c8908de [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersttaubert
bugs951725
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 951725: Notify sessionstore of browser restart in order to save session state. r=ttaubert
browser/base/content/browser.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -2469,18 +2469,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
 }