Bug 1185294 - dispatch quit-application-requested from BrowserUtils.jsm, patch by George Malamas, r=Mossop
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 05 Aug 2015 17:59:00 +0100
changeset 256591 0f220ddcc60b427d057b9fa73fc2671740b818d0
parent 256590 942ac3261a6999fa6f52fe0ea97ce56266cd35a1
child 256592 9fc0f0ba0cca12c09379aa95bdb798ac0fc937be
push id29180
push userkwierso@gmail.com
push dateFri, 07 Aug 2015 00:23:32 +0000
treeherdermozilla-central@b735f4eea935 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMossop
bugs1185294
milestone42.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 1185294 - dispatch quit-application-requested from BrowserUtils.jsm, patch by George Malamas, r=Mossop
toolkit/modules/BrowserUtils.jsm
--- a/toolkit/modules/BrowserUtils.jsm
+++ b/toolkit/modules/BrowserUtils.jsm
@@ -25,16 +25,22 @@ this.BrowserUtils = {
 
   /**
    * restartApplication: Restarts the application, keeping it in
    * safe mode if it is already in safe mode.
    */
   restartApplication: function() {
     let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"]
                        .getService(Ci.nsIAppStartup);
+    let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
+                       .createInstance(Ci.nsISupportsPRBool);
+    Services.obs.notifyObservers(cancelQuit, "quit-application-requested", "restart");
+    if (cancelQuit.data) { // The quit request has been canceled.
+      return false;
+    }
     //if already in safe mode restart in safe mode
     if (Services.appinfo.inSafeMode) {
       appStartup.restartInSafeMode(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
       return;
     }
     appStartup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
   },