Instantly share code, notes, and snippets.
Last activeApril 29, 2016 08:43
Save nobuoka/5181549 to your computer and use it in GitHub Desktop.
ブートストラップ型の XUL ベースの 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
varCc=Components.classes; | |
varCi=Components.interfaces; | |
varPromptService=Cc["@mozilla.org/embedcomp/prompt-service;1"] | |
.getService(Ci.nsIPromptService); | |
// インストール時に呼び出される | |
functioninstall(aData,aReason){ | |
PromptService.alert(null,"Bootstrapped Extension Sample","Install"); | |
} | |
// インストール後や Firefox 起動後などに呼び出される | |
functionstartup(aData,aReason){ | |
PromptService.alert(null,"Bootstrapped Extension Sample","Startup"); | |
} | |
// Firefox 終了前や拡張機能が無効化される際などに呼び出される | |
functionshutdown(aData,aReason){ | |
PromptService.alert(null,"Bootstrapped Extension Sample","Shutdown"); | |
} | |
// アンインストールされた後の Firefox 終了時などに呼び出される | |
functionuninstall(aData,aReason){ | |
PromptService.alert(null,"Bootstrapped Extension Sample","Uninstall"); | |
} |
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
<?xml version="1.0"?> | |
<rdf:RDFxmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | |
xmlns:em="http://www.mozilla.org/2004/em-rdf#"> | |
<rdf:Descriptionrdf: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 freeto join this conversation on GitHub. Already have an account?Sign in to comment