Created
February 18, 2012 06:52
-
-
Save xabolcs/1857916 to your computer and use it in GitHub Desktop.
Test bootstrap.js for RestartlessMenuItems.js at https://github.com/protz/thunderbird-stdlib/pull/4/files
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
const Cc = Components.classes; | |
const Ci = Components.interfaces; | |
const Cu = Components.utils; | |
Components.utils.import('resource://gre/modules/XPCOMUtils.jsm'); | |
Components.utils.import('resource://gre/modules/Services.jsm'); | |
function startup(aData, aReason) { | |
var fileuri = Services.io.newFileURI(aData.installPath); | |
if (!aData.installPath.isDirectory()) | |
fileuri = Services.io.newURI('jar:' + fileuri.spec + '!/', null, null); | |
Services.io.getProtocolHandler('resource').QueryInterface(Ci.nsIResProtocolHandler).setSubstitution('rrmenuitems', fileuri); | |
Components.utils.import('resource://rrmenuitems/RestartlessMenuItems.js'); | |
RestartlessMenuItems.add({label: "try1:config", id: "RRMenuitem1", url: "about:config"}); | |
RestartlessMenuItems.add({label: "try2:buildconfig", id: "RRMenuitem2", url: "about:buildconfig"}); | |
RestartlessMenuItems.add({label: "try3:console log", id: "RRMenuitem3", | |
onCommand: function () {Cu.reportError("Hi!");}, onUnload: function () { Cu.reportError("Bye!");} | |
}); | |
RestartlessMenuItems.add({label: "try4:remove 2", id: "RRMenuitem4", | |
onCommand: function () {RestartlessMenuItems.remove({id: "RRMenuitem2"})}, onUnload: function () { Cu.reportError("Bye!4");} | |
}); | |
RestartlessMenuItems.add({label: "try5:support-iconed", id: "RRMenuitem5", url: "about:support", image: 'chrome://mozapps/skin/extensions/category-plugins.png' | |
}); | |
} | |
function shutdown(aData, aReason) { | |
if (aReason == APP_SHUTDOWN) { | |
} else { | |
Components.utils.import('resource://rrmenuitems/RestartlessMenuItems.js'); | |
RestartlessMenuItems.removeAll(); | |
} | |
Services.io.getProtocolHandler('resource').QueryInterface(Ci.nsIResProtocolHandler).setSubstitution('rrmenuitems', null); | |
} | |
function install(aData, aReason) { } | |
function uninstall(aData, aReason) { } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment