Firefoxの拡張(extension)機能作成

Firefox用の拡張機能を作成する場合には以前では、xpiを作成してインストールして確認という開発サイクルだったようだが、1.5以降はIDファイルを作ってその中に開発用パスを書いておけばいいというのが、http://kb.mozillazine.org/Getting_started_with_extension_developmentに書いてあった。

  • install.rdfのem:idに適宜IDを指定
  • Profile Folder\extensions\上記で指定したID というファイルを作成
  • そのファイルには開発しているパス(C:\foo\extensionfolder)を記述

そのとおりにやってみていたのだが、ここ2,3日まったくうまく認識してくれなかった。

どうやら、IDとして指定するのはなんでもいいわけではなく、GUIDでなければメールアドレス風(foobar@example.com)にしないと認識してくれないみたい。

Before releasing your extension to the public you must thoroughly test it. To avoid problems during this phase it is advisable to create and use a new profile for testing it.

Once you created the files described above and have placed them in the appropriate folder structure, registering them in the Extension Manager is trivial. With Firefox closed, create a "pointer" file with the same name as your extension's ID in profile folder/extensions/, edit it so that it contains the path to your folder containing install.rdf and chrome.manifest files.

E.g. helloworld's ID is helloworld@mozilla.doslash.org and we would like to register it in X:\Dev\helloworld\ (i.e. there is X:\Dev\helloworld\install.rdf file etc.). Just put a single line into the file at this path: profile folder/extensions/helloworld@mozilla.doslash.org

X:\Dev\helloworld

Start Firefox and check your extension is installed. Then test it.

例ではメールアドレスになっているのはそういうことか。メールアドレス風にしないといけないとは読み取れなかった。。。

やっと認識してくれたのでこれで作成とテストができる。とりあえずよかった。