Visit Mozilla.org

Extension Packaging

出典: MDC


拡張機能は、利用者がダウンロードやインストールできる Installable Bundleの形式または、pre-パッケージされてアプリケーションまたは拡張プログラムと共に提供されます。拡張機能はXULプログラムの機能を拡張するための chrome、コンポーネント、およびその他のファイルを提供するのに ディレクトリ構造を使っています。

すべての拡張は、拡張機能についてのメタデータ(ユニークID、バージョン、制作者、および互換性情報など)を含むinstall.rdfファイルを備えなければなりません。。

拡張機能のファイルとinstall.rdfの用意ができたら、いくつかの方法で拡張機能のインストーラを作ります: 拡張機能ディレクトリをユーザがインストールできる XPI (xpinstall) ファイルにZIP圧縮、ユーザのアプリケーション profile ディレクトリに拡張機能ディレクトリを解凍するか、拡張機能をWindowsレジストリに登録する。

目次

[編集] 拡張機能 XPI の作り方

XPI (XPInstall) ファイルは単純なZIPファイルで、拡張機能ファイルとZIPのrootにはinstall.rdfを含んでいます。ユーザはXPIファイルをWebサイトからダウンロードしたりローカルファイルを拡張マネージャウインドウにドロップしてインストールできます。

Firefoxが識別する XPIファイルのMIME typeは、application/x-xpinstallです。たいていの HTTPサーバはデフォルトで .xpi 拡張機能に対してこの MIME type を返すようになっていません、大抵、HTTPサーバに設定が必要です。 Apache HTTP Server では、次の指示を設定ファイルまたは .htaccess に追加します:

AddType application/x-xpinstall .xpi

[編集] Install Extension Files Directly

もし、アプリケーションの位置を知っていれば (アプリケーションの一部として拡張機能をインストールする場合など)、拡張機能ファイルディレクトリを <appdir>/extensions/<extensionID> にインストールできます。拡張機能は次回アプリケーションを起動したときに自動的に拡張マネージャーに現れます。

When using this method you must verify that the file system permissions for the directories and files for the extension are set properly. Otherwise, the Extension Manager may not function properly with the extension or the extension itself may not work properly.

[編集] Windowsレジストリを使って拡張機能の場所を登録する

External installers (such as the Java runtime) may wish to install application integration points as extension even if the application is not yet installed. This can be accomplished on Windows using the registry.

[編集] マルチアイテム拡張 XPI

いくつかの場合、単一XPIファイルで複数の拡張/テーマをインストールすることがあります。 A special kind of extension XPI called the Multiple Item Package explains how to create this kind of package. (Firefox 1.5/XULRunner 1.8 required.)

[編集] Official References for Toolkit API