Skip to content

Instantly share code, notes, and snippets.

@nobuoka nobuoka/bootstrap.js
Last active Apr 29, 2016

Embed
What would you like to do?
ブートストラップ型の XUL ベースの Firefox 拡張としてのサンプル。
var Cc = Components.classes;
var Ci = Components.interfaces;
var PromptService = Cc["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Ci.nsIPromptService);
// インストール時に呼び出される
function install(aData, aReason) {
PromptService.alert(null, "Bootstrapped Extension Sample", "Install");
}
// インストール後や Firefox 起動後などに呼び出される
function startup(aData, aReason) {
PromptService.alert(null, "Bootstrapped Extension Sample", "Startup");
}
// Firefox 終了前や拡張機能が無効化される際などに呼び出される
function shutdown(aData, aReason) {
PromptService.alert(null, "Bootstrapped Extension Sample", "Shutdown");
}
// アンインストールされた後の Firefox 終了時などに呼び出される
function uninstall(aData, aReason) {
PromptService.alert(null, "Bootstrapped Extension Sample", "Uninstall");
}
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<rdf:Description rdf:about="urn:mozilla:install-manifest">
<em:id>bootstrapped-extension-sample@vividcode.info</em:id>
<em:name>Bootstrapped Extension Sample</em:name>
<em:version>1.0</em:version>
<em:type>2</em:type>
<em:bootstrap>true</em:bootstrap>
<em:targetApplication>
<rdf:Description>
<!-- Firefox -->
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>10.0</em:minVersion>
<em:maxVersion>20.0</em:maxVersion>
</rdf:Description>
</em:targetApplication>
</rdf:Description>
</rdf:RDF>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.