Firefox supports automated updates to add-ons using JSON update manifests. Add-ons hosted on AMO automatically receive updates to new versions posted there. Other add-ons must specify the location of their update manifests.
A typical update manifest looks something like:
{ "addons": { "addon@example.com": { "updates": [ { "version": "0.1", "update_link": "https://example.com/addon-0.1.xpi" }, { "version": "0.2", "update_link": "http://example.com/addon-0.2.xpi", "update_hash": "sha256:fe93c2156f05f20621df1723b0f39c8ab28cdbeec342efa95535d3abff932096" }, { "version": "0.3", "update_link": "https://example.com/addon-0.3.xpi", "applications": { "gecko": { "strict_min_version": "44" } } } ] } } }
Enabling updates to your extension
If your extension is not hosted on AMO, you must specify the location of your update manifest in your extension. For extensions developed with WebExtension APIs, add the following to your manifest:
"applications": { "gecko": { "update_url": "https://example.com/updates.json" } }
For XUL add-ons, add the following to the <Description about="urn:mozilla:install-manifest">
element of your install.rdf
file:
<em:updateURL>https://example.com/updates.json</em:updateURL>
Manifest Structure
The manifest is a JSON file, with a top-level object literal. This object may have the following properties:
Property | Type | Description |
---|---|---|
addons |
object |
An object containing one entry for each add-on to be updated. For each such entry, the name of the property must be the add-on's ID, and the value must be an object describing the add-on and its updates. |
Addon objects
addons[*]
Properties of the addons
object must contain object literals, each describing an add-on to update. These objects may have the following properties:
Property | Type | Description |
---|---|---|
updates |
Array Optional |
An array containing zero or more update description objects for the add-on. |
Update objects
addons[*].updates[*]
Update description objects must be object literals. They may have the following properties:
Property | Type | Description |
---|---|---|
version |
string |
The version number this update entry describes. If an update URL is specified, it must use this version. If any compatibility information is specified, it will override the compatibility information of any installed version with this version number. |
update_link |
string Optional |
A link to the XPI file containing this version of the add-on. This must be an HTTPS URL, or an update_hash must be provided to verify it. |
update_hash |
string Optional |
A cryptographic hash of the file pointed to by update_link . This must be provided if update_link is not a secure URL. If present, this must be a string beginning with either sha256: or sha512: , followed by the hexadecimal-encoded hash of the matching type. |
update_info_url |
string Optional |
A link to an HTML file containing information about the update. |
multiprocess_compatible |
bool Optional(default: true ) |
If false, this add-on requires compatibility shims to run in a multi-process Firefox environment. |
applications |
object Optional |
An object containing application-specific compatibility information. Each property must contain an application object, as described below. The only application currently supported is If this property is omitted, support for Gecko is assumed. Otherwise, if this property is defined, it must contain a |
Application objects
addons[*].updates[*].applications.gecko
Application objects specify compatibility information for a specific application. They must be object literals, and may have the following properties:
Property | Type | Description |
---|---|---|
strict_min_version |
string Optional(default: 42.0a1 ) |
The minimum version of the application this add-on will run on. |
strict_max_version |
string Optional(default: * ) |
The maximum version of the application this add-on will run on. |
advisory_max_version |
string Optional(default: * ) |
The maximum version of the application this add-on is likely to run on. This property is ignored in most cases. |
Testing Automatic Updating
By default, Firefox checks for updates every 86400 seconds (24 hours). If you want to test whether or not the updater is working for your extension, you should browse to about:config
and change the value of extensions.update.interval
from 86400 to 120, which is apparently the minimum supported value. (If you set it to less than 120, update checks will only occur every 2 minutes.) While you're in there, verify that extensions.update.enabled
is set to its default value of true
. Relaunch Firefox after making any changes.
If your extension does not update as expected, click in Firefox' menu: Tools > Web Developer > Browser Console, filter for the name of your extension or update URL, and see if there are any errors logged. If you see an error indicating that the downloaded file hash … did not match provided hash …, look up for the previous GET of your extension. If it indicates that the download time was around zero milliseconds, for example [HTTP/1.1 200 OK 0ms]
, Firefox may have used a cached download, which might be your prior version if you just recently uploaded a new version, and this may explain the hash mismatch.