AddonUpdateChecker

This article is in need of a technical review.

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 Addon.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: Mossop, Sheppy, trevorh, kscarfone
Last updated by: kscarfone,