author Kyle Huey <>
Sat, 15 Mar 2014 12:00:15 -0700
changeset 190962 32f48d6d3389ea5db45cfc6e452ec52595c11a43
parent 176933 940b2974f35b36a70b0c8a3f17a2647481b43590
child 272166 07c6eccd05c2de8e17e30256661ddc0d301c09c5
permissions -rw-r--r--
Bug 967364: Rename already_AddRefed::get to take. r=bsmedberg

.. _jar_manifests:

JAR Manifests

JAR Manifests are plaintext files in the tree that are used to package chrome
files into the correct JARs, and create
`Chrome Registration <>`_
manifests. JAR Manifests are commonly named ````. They are
declared in ```` files using the ``JAR_MANIFESTS`` variable.

```` files are automatically processed by the build system when building a
source directory that contains one. The ``jar``.mn is run through the
:ref:`preprocessor` before being passed to the manifest processor. In order to
have ``@variables@`` expanded (such as ``@AB_CD@``) throughout the file, add
the line ``#filter substitution`` at the top of your ```` file.

The format of a is fairly simple; it consists of a heading specifying
which JAR file is being packaged, followed by indented lines listing files and
chrome registration instructions.

To see a simple ```` file at work, see ``toolkit/profile/``. A much
more complex ```` is at ``toolkit/locales/``.

Shipping Chrome Files

To ship chrome files in a JAR, an indented line indicates a file to be packaged::

     path/in/jar/file_name.xul     (source/tree/location/file_name.xul)

The source tree location may also be an *absolute* path (taken from the
top of the source tree::

   path/in/jar/file_name.xul     (/path/in/sourcetree/file_name.xul)

An asterisk marker (``*``) at the beginning of the line indicates that the
file should be processed by the :ref:`preprocessor` before being packaged::

   * path/in/jar/preprocessed.xul  (source/tree/location/file_name.xul)

A plus marker (``+``) at the beginning of the line indicates that the file
should replace an existing file, even if the source file's timestamp isn't
newer than the existing file::

   + path/in/jar/file_name.xul     (source/tree/location/my_file_name.xul)

Preprocessed files always replace existing files, to ensure that changes in
``#expand`` or ``#include`` directives are picked up, so ``+`` and ``*`` are

There is a special source-directory format for localized files (note the
percent sign in the source file location): this format reads ``localized.dtd``
from the ``en-US`` directory if building an English version, and reads the
file from the alternate localization source tree
``/l10n/<locale>/path/localized.dtd`` if building a localized version::

   locale/path/localized.dtd     (%localized/path/localized.dtd)

Register Chrome

`Chrome Registration <>`_
instructions are marked with a percent sign (``%``) at the beginning of the
line, and must be part of the definition of a JAR file. Any additional percents
signs are replaced with an appropriate relative URL of the JAR file being

   % content global %path/in/jar/
   % overlay chrome://blah/content/blah.xul chrome://foo/content/overlay.xul

There are two possible locations for a manifest file. If the chrome is being
built into a standalone application, the ```` processor creates a
``<jarfilename>.manifest`` next to the JAR file itself. This is the default

If the build specifies ``USE_EXTENSION_MANIFEST = 1``, the ```` processor
creates a single ``chrome.manifest`` file suitable for registering chrome as
an extension.