AddonUpdateChecker

Add-ons using the techniques described in this document are considered a legacy technology in Firefox. Don't use these techniques to develop new add-ons. Use WebExtensions instead. If you maintain an add-on which uses the techniques described here, consider migrating it to use WebExtensions.

From Firefox 53 onwards, no new legacy add-ons will be accepted on addons.mozilla.org (AMO).

From Firefox 57 onwards, WebExtensions will be the only supported extension type, and Firefox will not load other types.

Even before Firefox 57, changes coming up in the Firefox platform will break many legacy extensions. These changes include multiprocess Firefox (e10s), sandboxing, and multiple content processes. Legacy extensions that are affected by these changes should migrate to WebExtensions if they can. See the "Compatibility Milestones" document for more.

A wiki page containing resources, migration paths, office hours, and more, is available to help developers transition to the new technologies.

The AddonUpdateChecker is used to download and parse update information for an add-on's update manifest. If all you care about is finding the newest version for an Addon then you probably want to use findUpdates() instead.

To import the AddonUpdateChecker, use:

Components.utils.import("resource://gre/modules/AddonUpdateChecker.jsm");

Method Overview

UpdateInfo getCompatibilityUpdate(in UpdateInfo updates[], in string version, in boolean ignoreCompatibility, in string appVersion, in string platformVersion)
UpdateInfo getNewestCompatibleUpdate(in UpdateInfo updates[], in string appVersion, in string platformVersion)
void checkForUpdates(in string id, in string type, in string updateKey, string URL, in UpdateCheckListener listener)

Constants

Constant Description
ERROR_TIMEOUT The update check timed out.
ERROR_DOWNLOAD_ERROR There was an error while downloading the update information.
ERROR_PARSE_ERROR The update information was malformed in some way.
ERROR_UNKNOWN_FORMAT The update information was not in any known format.
ERROR_SECURITY_ERROR The update information was not signed by the update key used for retrieval.

Methods

getCompatibilityUpdate()

Retrieves the best matching compatibility update for the application from a list of available update objects.

UpdateInfo getCompatibilityUpdate(
  in UpdateInfo updates[],
  in string version,
  in boolean ignoreCompatibility,
  in string appVersion,
  in string platformVersion
)
Parameters
updates
An array of update objects
version
The version of the add-on to get new compatibility information for
ignoreCompatibility
An optional parameter to get the first compatibility update that is compatible with any version of the application or toolkit
appVersion
The version of the application or null to use the current version
platformVersion
The version of the platform or null to use the current version

getNewestCompatibleUpdate()

Returns the newest available update from a list of update objects.

UpdateInfo getNewestCompatibleUpdate(
  in UpdateInfo updates[],
  in string appVersion,
  in string platformVersion
)
Parameters
updates
An array of update objects
appVersion
The version of the application or null to use the current version
platformVersion
The version of the platform or null to use the current version

checkForUpdates()

Starts an update check.

void checkForUpdates(
  in string id,
  in string type,
  in string updateKey,
  string URL,
  in UpdateCheckListener listener
)
Parameters
id
The ID of the add-on being checked for updates
type
The type of add-on being checked for updates
updateKey
An optional update key for the add-on
URL
The URL of the add-on's update manifest
listener
An observer to notify of results

Document Tags and Contributors

 Contributors to this page: bunnybooboo, Leif-AMO, kscarfone, Sheppy, trevorh, Mossop
 Last updated by: bunnybooboo,