開発環境 |
Mozilla Add-on SDK 1.17 |
実行環境 |
Windows 8.1 (64bit) |
ログ出力について
cfxのコマンド
init |
create a sample addon in an empty directory |
test |
構文チェックを行う。 |
run |
アドオンを走らせてみる。インストールはされない。 |
xpi |
generate an xpi(Cross-Platform Install) |
サンプルプログラム
hello2プロジェクトを作り、以下のソースを入力する。
lib\main.js
var { Cc, Ci } = require("chrome");
function Log(msg) {
var consoleService = Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService);
consoleService.logStringMessage(msg);
}
Log("hello, world");
(C:\etc\addon-sdk-1.17) C:\Projects\Firefox\hello2>cfx test
Using binary at 'C:\Program Files (x86)\Mozilla Firefox\firefox.exe'.
Using profile at 'c:\users\lance\appdata\local\temp\tmpfeyc7j.mozrunner'.
Running tests on Firefox 38.0.1/Gecko 38.0.1 ({ec8030f7-c20a-464f-9b0e-13a3a9e97
384}) under winnt/x86.
..
2 of 2 tests passed.
Total time: 3.786000 seconds
Program terminated successfully.
(C:\etc\addon-sdk-1.17) C:\Projects\Firefox\hello2>cfx run
Using binary at 'C:\Program Files (x86)\Mozilla Firefox\firefox.exe'.
Using profile at 'c:\users\lance\appdata\local\temp\tmpgct8io.mozrunner'.
Total time: 60.510000 seconds
Program terminated successfully.
(C:\etc\addon-sdk-1.17) C:\Projects\Firefox\hello2>cfx xpi
Exporting extension to hello2.xpi.
Firefoxのアドオンマネージャを開く。(Ctrl+Shift+A)
左側の拡張機能を選択し、hello2.xpi をdrag&dropしインストールする。
最終更新:2015年05月17日 09:42