Structure of an installable bundle

  • Revision slug: Bundles
  • Revision title: Structure of an installable bundle
  • Revision id: 72305
  • Created:
  • Creator: Nickolay
  • Is current revision? No
  • Comment switch to a table, mention that additional resources can be registered in chrome.manifest; 34 words added

Revision Content

XULRunner applications, extensions, and themes all share a common directory structure, and in some cases the same bundle can be used as a standalone XULRunner application as well as an installable application extension.

Basic structure of a bundle

A bundle may include any of the following files:

 

 

Path from the root of the bundle Description Mozilla versions supporting this feature
/install.rdf Extension/Theme Install Manifest  
/application.ini Application Launch Manifest  
/components/* Component and XPT Files (>=1.7)  
/defaults/preferences/*.js Default Preferences (>=1.7)  
/plugins/* NPAPI Plugins (>=1.8)  
/chrome.manifest Chrome Registration Manifest (>=1.8)  
/chrome/icons/default/* Window Icons (>=1.8)
... Additional resources (such as chrome:// or resource:// providers can be registered in the chrome.manifest)  

Of course, an extension need not (and normally won't) have all of these directories. Themes are limited for security reasons, and can normally only provide a chrome.manifest which registers the theme and a JAR file.

Platform-specific subdirectories: Gecko 1.9.2.x and earlier

{{ gecko_callout_heading("2.0") }}

Platform-specific subdirectory support was removed in Gecko 2.0 {{ geckoRelease("2.0") }}. See the section Platform-specific files to learn how to use platform-specific files.

In some cases a single extension or application may wish to include binary component or plugins for multiple platforms, or theme authors might want to include multiple platform-specific JAR files. To facilitate the first case, the extension/app loader has special sub-directories specifically for platform-specific files (starting with Toolkit/Gecko 1.8, Firefox/Thunderbird 1.5). The platform string is defined during the toolkit build process to a value unique for the combination of operating system, processor architecture and compiler. The format of the platform string is:

{OS_TARGET}_{TARGET_XPCOM_ABI}

All of the files which are loaded from the main extension directory are loaded from the subdirectory

/platform/{platform string}

if it exists. For example, if a plugin vendor wanted to make a plugin available for consumer computers running Linux(of the form: /platform/Linux*/), Macintosh(of the form: /platform/Darwin*/), and Windows(of the form: /platform/WIN*/), it would provide the following files:

/platform/Linux_x86-gcc3/plugins/libMyPlugin.so
/platform/WINNT_x86-msvc/plugins/MyPlugin.dll
/platform/Darwin_ppc-gcc3/plugins/libMyPlugin.dylib

Because XPT files are not platform-specific, any associated XPT files would go in the generic components directory:

/components/MyPlugin.xpt

If an extension has non-binary platform-specific code (such as code which uses the windows registry from script), it can also use just the operating system identifier as a platform-subdirectory:

/platform/WINNT/components/registerDoctype.js

When platform-specific JAR files are used, each platform directory should have its own chrome.manifest file:

chrome.manifest
chrome/mytheme-base.jar
platform/Darwin/chrome.manifest
platform/Darwin/chrome/mytheme-mac.jar
platform/WINNT/chrome.manifest
platform/WINNT/chrome/mytheme-win.jar

The app/extension loader processes the base directory first, followed by the applicable platform directories (first /{OS_TARGET}/, then /{OS_TARGET}_{TARGET_XPCOM_ABI}/). When default preferences are defined in several directories, the ones loaded later overwrite the earlier ones.

Platform-specific files

Gecko 2.0 {{ geckoRelease("2.0") }} removed support for platform-specific subdirectories. Instead, you need to use manifest flags, such as the OS and ABI flags, in your chrome manifest to specify components that should be loaded for specific platforms.

For example:

binary-component components/windows/mycomponent.dll ABI=WINNT_x86-msvc
binary-component components/mac/mycomponent.dylib ABI=Darwin_x86-gcc3
binary-component components/mac/mycomponent64.dylib ABI=Darwin_x86_64-gcc3
binary-component components/linux/mycomponent.so ABI=Linux_x86-gcc3

Application-specific extension files

In addition to the extension files listed above, applications may read additional files from extensions. For example, Firefox 1.5 and greater will read Sherlock search plugins from

/searchplugins/*.src

Firefox 2 and greater will additionally read MozSearch and OpenSearch plugins from

/searchplugins/*.xml

and Myspell dictionaries from

/dictionaries/*.{aff|dic}

Official references for toolkit API

{{ Toolkit_API_Official_References() }}

{{ languages( { "de": "de/Bundles", "es": "es/Bundles", "fr": "fr/Bundles", "ja": "ja/Bundles", "ko": "ko/Bundles", "pl": "pl/Paczki" } ) }}

Revision Source

<p><a href="/en/XUL_Application_Packaging" title="en/XUL_Application_Packaging">XULRunner applications</a>, <a href="/en/Extensions" title="en/Extensions">extensions</a>, and <a href="/en/Themes" title="en/Themes">themes</a> all share a common directory structure, and in some cases the same bundle can be used as a standalone XULRunner application as well as an installable application extension.</p>
<h3 name="Basic_Structure_of_a_Bundle">Basic structure of a bundle</h3>
<p>A bundle may include any of the following files:</p>
<p> </p>
<p> </p>
<table class="fullwidth-table"> <thead> <tr> <th>Path from the root of the bundle</th> <th>Description</th> <th>Mozilla versions supporting this feature</th> </tr> </thead> <tbody> <tr> <td><code>/<a href="/en/Install_Manifests" title="en/Install_Manifests">install.rdf</a></code></td> <td>Extension/Theme Install Manifest</td> <td> </td> </tr> <tr> <td><code>/<a href="/en/XUL_Application_Packaging" title="en/XUL_Application_Packaging">application.ini</a></code></td> <td>Application Launch Manifest</td> <td> </td> </tr> <tr> <td><code>/components/*</code></td> <td>Component and XPT Files</td> <td><a href="/en/Gecko#Versions_of_Gecko" title="en/Gecko#Versions_of_Gecko">(&gt;=1.7)</a></td> <td> </td> </tr> <tr> <td><code><a href="/en/Building_an_Extension#Defaults_Files" title="en/Building_an_Extension#Defaults_Files">/defaults/preferences/*.js</a></code></td> <td>Default Preferences</td> <td><a href="/en/Gecko#Versions_of_Gecko" title="en/Gecko#Versions_of_Gecko">(&gt;=1.7)</a></td> <td> </td> </tr> <tr> <td><code>/plugins/*</code></td> <td>NPAPI Plugins</td> <td><a href="/en/Gecko#Versions_of_Gecko" title="en/Gecko#Versions_of_Gecko">(&gt;=1.8)</a></td> <td> </td> </tr> <tr> <td><code>/<a href="/en/Chrome_Registration#The_Chrome_Registry" title="en/Chrome_Registration#The_Chrome_Registry">chrome.manifest</a></code></td> <td>Chrome Registration Manifest</td> <td><a href="/en/Gecko#Versions_of_Gecko" title="en/Gecko#Versions_of_Gecko">(&gt;=1.8)</a></td> <td> </td> </tr> <tr> <td><code>/<a href="/en/Window_icons" title="en/Window_icons">chrome/icons/default/*</a></code></td> <td>Window Icons</td> <td><a href="/en/Gecko#Versions_of_Gecko" title="en/Gecko#Versions_of_Gecko">(&gt;=1.8)</a></td> </tr> <tr> <td>...</td> <td>Additional resources (such as chrome:// or resource:// providers can be registered in the <a href="/en/Chrome_registration" title="en/Chrome registration">chrome.manifest</a>)</td> <td> </td> </tr> </tbody>
</table>
<p>Of course, an extension need not (and normally won't) have all of these directories. Themes are limited for security reasons, and can normally only provide a <a href="/en/Chrome_Registration" title="en/Chrome_Registration">chrome.manifest</a> which registers the theme and a JAR file.</p><h3 name="Platform-specific_Subdirectories">Platform-specific subdirectories: Gecko 1.9.2.x and earlier</h3>
<div class="geckoVersionNote">
<p>{{ gecko_callout_heading("2.0") }}</p>
<p>Platform-specific subdirectory support was removed in Gecko 2.0 {{ geckoRelease("2.0") }}. See the section <a href="/en/Bundles#Platform-specific_files" title="en/Bundles#Platform-specific files">Platform-specific files</a> to learn how to use platform-specific files.</p>
</div>
<p>In some cases a single extension or application may wish to include binary component or plugins for multiple platforms, or theme authors might want to include multiple platform-specific JAR files. To facilitate the first case, the extension/app loader has special sub-directories specifically for platform-specific files (starting with Toolkit/Gecko 1.8, Firefox/Thunderbird 1.5). The platform string is defined during the toolkit build process to a value unique for the combination of operating system, processor architecture and compiler. The format of the platform string is:</p>
<pre class="eval"><em>{<a href="/en/OS_TARGET" title="en/OS_TARGET">OS_TARGET</a>}</em>_<em>{<a href="/en/XPCOM_ABI" title="en/XPCOM_ABI">TARGET_XPCOM_ABI</a>}</em>
</pre>
<p>All of the files which are loaded from the main extension directory are loaded from the subdirectory</p>
<pre class="eval">/platform/<em>{platform string}</em>
</pre>
<p>if it exists. For example, if a plugin vendor wanted to make a plugin available for consumer computers running Linux(of the form: /platform/Linux*/), Macintosh(of the form: /platform/Darwin*/), and Windows(of the form: /platform/WIN*/), it would provide the following files:</p>
<pre class="eval">/platform/Linux_x86-gcc3/plugins/libMyPlugin.so
/platform/WINNT_x86-msvc/plugins/MyPlugin.dll
/platform/Darwin_ppc-gcc3/plugins/libMyPlugin.dylib
</pre>
<p>Because XPT files are not platform-specific, any associated XPT files would go in the generic components directory:</p>
<pre class="eval">/components/MyPlugin.xpt
</pre>
<p>If an extension has non-binary platform-specific code (such as code which uses the windows registry from script), it can also use just the operating system identifier as a platform-subdirectory:</p>
<pre class="eval">/platform/WINNT/components/registerDoctype.js
</pre>
<p>When platform-specific JAR files are used, each platform directory should have its own <code>chrome.manifest</code> file:</p>
<pre class="eval">chrome.manifest
chrome/mytheme-base.jar
platform/Darwin/chrome.manifest
platform/Darwin/chrome/mytheme-mac.jar
platform/WINNT/chrome.manifest
platform/WINNT/chrome/mytheme-win.jar
</pre>
<p>The app/extension loader processes the base directory first, followed by the applicable platform directories (first /{OS_TARGET}/, then /{<a href="/en/OS_TARGET" title="en/OS_TARGET">OS_TARGET</a>}_{<a href="/en/XPCOM_ABI" title="en/XPCOM_ABI">TARGET_XPCOM_ABI</a>}/). When default preferences are defined in several directories, the ones loaded later overwrite the earlier ones.</p>
<h3>Platform-specific files</h3>
<p>Gecko 2.0 {{ geckoRelease("2.0") }} removed support for platform-specific subdirectories. Instead, you need to use manifest flags, such as the <a href="/en/Chrome_Registration#os" title="en/Chrome Registration#os"><code>OS</code></a> and <a href="/en/Chrome_Registration#abi" title="en/Chrome Registration#abi"><code>ABI</code></a> flags, in your <a href="/en/Chrome_Registration" title="en/Chrome Registration">chrome manifest</a> to specify components that should be loaded for specific platforms.</p>
<p>For example:</p>
<pre>binary-component components/windows/mycomponent.dll ABI=WINNT_x86-msvc
binary-component components/mac/mycomponent.dylib ABI=Darwin_x86-gcc3
binary-component components/mac/mycomponent64.dylib ABI=Darwin_x86_64-gcc3
binary-component components/linux/mycomponent.so ABI=Linux_x86-gcc3
</pre>
<h3 name="Application-specific_Extension_Files">Application-specific extension files</h3>
<p>In addition to the extension files listed above, applications may read additional files from extensions. For example, <a href="/en/Firefox_1.5_for_developers" title="en/Firefox_1.5_for_developers">Firefox 1.5</a> and greater will read Sherlock search plugins from</p>
<pre class="eval">/searchplugins/*.src
</pre>
<p><a href="/en/Firefox_2_for_developers" title="en/Firefox_2_for_developers">Firefox 2</a> and greater will additionally read <a href="/en/Creating_MozSearch_plugins" title="en/Creating_MozSearch_plugins">MozSearch and OpenSearch plugins</a> from</p>
<pre class="eval">/searchplugins/*.xml
</pre>
<p>and Myspell dictionaries from</p>
<pre class="eval">/dictionaries/*.{aff|dic}
</pre>
<h3 name="Official_References_for_Toolkit_API">Official references for <a href="/en/Toolkit_API" title="en/Toolkit_API">toolkit API</a></h3>
<p>{{ Toolkit_API_Official_References() }}</p>
<p>{{ languages( { "de": "de/Bundles", "es": "es/Bundles", "fr": "fr/Bundles", "ja": "ja/Bundles", "ko": "ko/Bundles", "pl": "pl/Paczki" } ) }}</p>
Revert to this revision