Bug 589098: Add-ons manager cannot restart xulrunner-based apps because Application is undefined. r=Unfocused, a=blocking-betaN
authorDave Townsend <dtownsend@oxymoronical.com>
Mon, 13 Sep 2010 10:48:24 -0700
changeset 53712 6e12dfb03f56a7e538f00aa2be41a59dec5a0fc1
parent 53711 a0cb638ed3a5842a7734691fb336473c288e52a1
child 53713 33405969cb629369735b5c6269f8c6c5ae67ce2b
push id15681
push userdtownsend@mozilla.com
push dateMon, 13 Sep 2010 19:55:54 +0000
treeherdermozilla-central@33405969cb62 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersUnfocused, blocking-betaN
bugs589098
milestone2.0b6pre
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 589098: Add-ons manager cannot restart xulrunner-based apps because Application is undefined. r=Unfocused, a=blocking-betaN
toolkit/mozapps/extensions/content/extensions.js
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -496,17 +496,26 @@ var gViewController = {
       doCommand: function() {
         window.history.forward();
       }
     },
 
     cmd_restartApp: {
       isEnabled: function() true,
       doCommand: function() {
-        Application.restart();
+        let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"].
+                         createInstance(Ci.nsISupportsPRBool);
+        Services.obs.notifyObservers(cancelQuit, "quit-application-requested",
+                                     "restart");
+        if (cancelQuit.data)
+          return; // somebody canceled our quit request
+
+        let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"].
+                         getService(Ci.nsIAppStartup);
+        appStartup.quit(Ci.nsIAppStartup.eAttemptQuit |  Ci.nsIAppStartup.eRestart);
       }
     },
 
     cmd_enableCheckCompatibility: {
       isEnabled: function() true,
       doCommand: function() {
         Services.prefs.clearUserPref(gEventManager.checkCompatibilityPref);
       }