開発環境 |
Mozilla Add-on SDK 1.17 |
実行環境 |
Windows 8.1 (64bit) |
Add-on SDKのインストール
Pythonの2.xの最新版をインストールする。(3.xはサポートしていない)
環境が64bitなので python-2.7.9.amd64.msi を選んだが特に問題はない。
Pathを通せば python で起動できるが、通さなくても問題ないので通していない。
addon-sdk-1.17.zip を適当なディレクトリに解凍する。
例)C:\etc\addon-sdk-1.17
システム→システムの詳細設定→環境変数
ユーザー環境変数 Path に C:\etc\addon-sdk-1.17\bin を追加する。
開発
開発ディレクトリを用意する。
例)C:\Projects\
Firefox
プロジェクトのディレクトリを作る。
例)C:\Projects\Firefox\hello
エクスプローラーのアドレスバーに cmd と入力しコマンドプロンプトを起動する。
以下のコマンドで仮想環境を起動し、プロジェクトを初期化する。
activate
cfx init
C:\Projects\Firefox\hello>activate
Welcome to the Add-on SDK. For the docs, visit https://addons.mozilla.org/en-US/
developers/docs/sdk/latest/
(C:\etc\addon-sdk-1.17) C:\Projects\Firefox\hello>cfx init
* lib directory created
* data directory created
* test directory created
* generated jID automatically: jid1-akV80sChVjmRhg
* package.json written
* test/test-main.js written
* lib/main.js written
Your sample add-on is now ready.
Do "cfx test" to test it and "cfx run" to try it. Have fun!
lib\main.js を以下のように編集し、テストしてみる。
console.log("hello, world");
(C:\etc\addon-sdk-1.17) C:\Projects\Firefox\hello>cfx test
Using binary at 'C:\Program Files (x86)\Mozilla Firefox\firefox.exe'.
Using profile at 'c:\users\lance\appdata\local\temp\tmpin2gxm.mozrunner'.
Running tests on Firefox 38.0.1/Gecko 38.0.1 ({ec8030f7-c20a-464f-9b0e-13a3a9e97
384}) under winnt/x86.
console.log: hello: hello, world
..
2 of 2 tests passed.
Total time: 4.064000 seconds
Program terminated successfully.
最終更新:2015年05月16日 21:25