Created
December 12, 2008 06:31
-
-
Save satyr/35040 to your computer and use it in GitHub Desktop.
Quick-restarts Firefox.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CmdUtils.CreateCommand({ | |
name: 'restart', | |
icon: 'chrome://ubiquity/skin/icons/arrow_redo.png', | |
description: | |
(''+<>Restarts Firefox quickly. | |
( based on <a href="chrome://mozapps/content/extensions/extensions.js" | |
>restartApp</a>)</>), | |
execute: function(){ | |
const os = (Cc['@mozilla.org/observer-service;1'] | |
.getService(Ci.nsIObserverService)); | |
const cancelQuit = (Cc['@mozilla.org/supports-PRBool;1'] | |
.createInstance(Ci.nsISupportsPRBool)); | |
os.notifyObservers(cancelQuit, 'quit-application-requested', 'restart'); | |
if(cancelQuit.data) return displayMessage({ | |
icon: this.icon, title: this.name, | |
text: 'Something aborted the quit process', | |
}); | |
const {nsIAppStartup} = Ci; | |
Cc['@mozilla.org/toolkit/app-startup;1'].getService(nsIAppStartup) | |
.quit(nsIAppStartup.eRestart | nsIAppStartup.eAttemptQuit); | |
}, | |
author: 'satyr'.link('http://d.hatena.ne.jp/murky-satyr'), | |
license: 'MIT', | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment