Multiple Item Package

此页有脚本错误。在网站编辑解决此问题前,你可以查看以上的部分内容。

A Multiple Item Package provides the ability to package multiple Installable Bundles which can then be downloaded and installed by a user, or provided pre-packaged with an application or by an external program. Every Multiple Item Package must provide an install.rdf file (not old-style install.js!) and has the same requirements as an Extension except as noted below.

There is currently no facility to prevent or warn the user when installing a previous version of an extension.


Multiple Item Package File Layout

The Multiple Item Package file layout is a simplified form of an Installable Bundle and requires a file extension of <tt>xpi</tt>. A Multiple Item Package may contain both extensions (e.g. <tt>xpi</tt> file extension) and themes (e.g. <tt>jar</tt> file extension). The basic structure is shown below:

/install.rdf                        Install Manifest
/extension1.xpi                     Extension
/extension2.xpi                     Extension
/theme1.jar                         Theme
/theme2.jar                         Theme
...

The Extension Manager will read the <tt>install.rdf</tt> Install Manifest to determine if this is a Multiple Item Package and then start the installation of the individual packages it contains automatically. No other files besides the install.rdf Install Manifest and the files with a <tt>jar</tt> and <tt>xpi</tt> file extension will be extracted or utilized.

install.rdf

A Multiple Item Package does not have the same requirements as an Extension for its install.rdf. The only required items are <tt>em:id</tt>, <tt>em:targetApplication</tt>, and <tt>em:type</tt>.

For the Firefox and Thunderbird 1.5 Extension Manager to determine that this package is a Multiple Item Package the <tt>em:type</tt> specified in your install.rdf must be <tt>32</tt> and specified as <tt><em:type NC:parseType="Integer">32</em:type></tt>. The XML namespace <tt>xmlns:NC="http://home.netscape.com/NC-rdf#"</tt> must also be declared in your install.rdf as shown below.

...
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:NC="http://home.netscape.com/NC-rdf#"
     xmlns:em="http://www.mozilla.org/2004/em-rdf#">

  <Description about="urn:mozilla:install-manifest">
    <!-- nsIUpdateItem type for a Multiple Item Package -->
    <em:type NC:parseType="Integer">32</em:type>
...

For the Firefox and Thunderbird 2.0 Extension Manager you can use the previous syntax or <tt><em:type>32</em:type></tt> as shown below.

...
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:em="http://www.mozilla.org/2004/em-rdf#">

  <Description about="urn:mozilla:install-manifest">
    <!-- nsIUpdateItem type for a Multiple Item Package -->
    <em:type>32</em:type>
...

When specifying <tt>em:targetApplication</tt> the <tt>minVersion</tt> specified should be the highest <tt>minVersion</tt> and the <tt>maxVersion</tt> specified should be the lowest <tt>maxVersion</tt> from all of the Installable Bundles contained by the Multiple Item Package for the <tt>em:targetApplication</tt>. If this is not done then any items that are not compatible will not be installed unless a compatibility check discovers updated compatibility information that makes it compatible.

Installation

Installation can be performed using any of the existing methods used for installing extensions / themes and the same user interface is used for installing a Multiple Item Package (the individual packages contained in the Multiple Item Package will not be listed). This also allows displaying of signing information for the Multiple Item Package.

If a manager (e.g. Extension / Theme Manager) is displayed then after the download of the Multiple Item Package completes the manager will display the individual items contained by the Multiple Item Package in the same manner that it would if the user had chosen to install multiple items simultaneously. The manager will not display the Multiple Item Package in the list of items after the download of the Multiple Item Package has completed.

Official References for Toolkit API

{{ :cn/Toolkit_API/Official_References }}

Document Tags and Contributors

Contributors to this page: Duwei
最后编辑者: Duwei,