|開発環境|Mozilla Add-on SDK 1.17| |実行環境|Windows 8.1 (64bit)| #table_zebra(project, #fff, #eee) *ログ出力について https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/console console.log console.error を試してみたがあまりしっくり来ない。 *cfxのコマンド |init|create a sample addon in an empty directory| |test|構文チェックを行う。| |run|アドオンを走らせてみる。インストールはされない。| |xpi|generate an xpi(Cross-Platform Install)| *サンプルプログラム hello2プロジェクトを作り、以下のソースを入力する。 lib\main.js #highlight(javascript){{ var { Cc, Ci } = require("chrome"); function Log(msg) { var consoleService = Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService); consoleService.logStringMessage(msg); } Log("hello, world"); }} #highlight(txt){{ (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. }} [[Firefox]]のブラウザコンソールを開く。(Ctrl+Shift+J) JS([[JavaScript]])のログに出力される。 #highlight(txt){{ (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しインストールする。