mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-12 00:50:40 +00:00
eaa4aed34f
MozReview-Commit-ID: FuNNtBSZwc --HG-- extra : rebase_source : 9426318458d58dccd4352503de27ba2b809e5bb2
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|
|
|
const CHILD_SCRIPT = "chrome://quitter/content/contentscript.js";
|
|
|
|
const quitterObserver = {
|
|
init() {
|
|
Services.mm.addMessageListener("Quitter.Quit", this);
|
|
Services.mm.loadFrameScript(CHILD_SCRIPT, true);
|
|
},
|
|
|
|
uninit() {
|
|
Services.mm.removeMessageListener("Quitter.Quit", this);
|
|
Services.mm.removeDelayedFrameScript(CHILD_SCRIPT, true);
|
|
},
|
|
|
|
/**
|
|
* messageManager callback function
|
|
* This will get requests from our API in the window and process them in chrome for it
|
|
**/
|
|
receiveMessage(aMessage) {
|
|
switch (aMessage.name) {
|
|
case "Quitter.Quit":
|
|
Services.startup.quit(Ci.nsIAppStartup.eForceQuit);
|
|
break;
|
|
}
|
|
}
|
|
};
|
|
|
|
function startup(data, reason) {
|
|
quitterObserver.init();
|
|
}
|
|
|
|
function shutdown(data, reason) {
|
|
quitterObserver.uninit();
|
|
}
|
|
|
|
function install(data, reason) {}
|
|
function uninstall(data, reason) {}
|