Introduction
A .xpi file packages an add-on for
Firefox. It is a
ZIP archive with another extension, as Mozilla’s
documentation says. Today’s add-ons are WebExtensions: the archive holds the
extension’s files directly, with a
manifest.json at the top. That file is the
same kind of manifest as a Chrome extension’s.
Add-ons from before WebExtensions have an install.rdf instead. Older
still, an XPInstall package has an install.js script. The name comes
from the old XPInstall installer.
Structure
A file dropped on any page of this site opens in the explorer, which shows the manifest, the signing files and every member of the archive.
ZIPmanifest.jsonthe extension’s manifest, at the top of the archiverequiredZIPThe extension’s files scripts, pages, images,_locales/variesZIPMETA-INF/the signatures, in a signed add-onsigned add-ons
Mozilla’s documentation is explicit that the archive holds the extension’s files themselves, not the folder they are in. Mozilla signs add-ons, and release versions of Firefox install only signed ones.
The rest of the format is described on these pages:
- Signing – the files in META-INF
- install.rdf – the legacy add-on manifest
- manifest.json – the manifest of a WebExtension
Not described
Known, not yet covered
- Viewer: trust is not decided. The digests of every file, the signature file, the PKCS #7 signature in
mozilla.rsaand the COSE signature are all checked (see what the explorer checks), but whether the certificates chain to Mozilla’s roots, their expiry and revocation are not, because that needs the root list Firefox ships. The olderzigbert.sfandzigbert.rsafiles are checked as JAR signature files only when they are named like.sfand.rsafiles, and the older XPInstallinstall.jssigning is not described. - Reference: the signing page names the signing files. The WebExtension files an add-on holds are not described here:
_locales/<language>/messages.json, language packs (langpackadd-ons), search provider and dictionary add-ons, and the update manifest thatbrowser_specific_settings.gecko.update_urlpoints to. The XPInstallinstall.jsscript is named but its commands are not described. - Viewer: the Firefox language pack keys (
langpack_id,languages,sources) and any key that MDN’s manifest.json pages do not list are shown as raw JSON in an “Other keys” table, with no meaning given.
Links
Software
- Firefox – Mozilla’s browser, which installs add-ons from .xpi files (Windows, macOS, Linux)
- addons.mozilla.org – Mozilla’s site for publishing and installing add-ons
Developers
- web-ext – Mozilla’s command-line tool that builds and signs add-ons (Node.js)
Reference
- Package your extension – Mozilla’s description of the package
- WebExtensions – MDN’s documentation of the extension system