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
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