Extension Manager:API Rewrite:API
AddonManager
The AddonManager is the global API that allows access to all types of add-ons. It hides the differences in implementations presenting a standard interface to developers.
getInstallForURL
Creates a new object representing an add-on installation from a url.
TODO This probably needs to be asynchronous to look up the mimetype of the url to determine the add-on type and maybe the signing certificate. Also move name and version arguments into a generic parameters object.
- name
- A human readable name for the add-on to be displayed during install (optional)
- version
- The version of the add-on to be installed (optional)
- url
- The URL to install the add-on from
- hash
- A hash of the file to be downloaded
- returns
- An AddonInstall for the installation
getInstallForFile
Creates a new object reperesenting an add-on installation from a local file, properties for the install will be loaded out of the file synchronously.
- file
- A
nsIFileto install the add-on from
- returns
- An AddonInstall for the installation
getInstalls
Returns the list of known add-on installs optionally restricting to a set of types of add-ons.
- types
- An array of types of add-ons to return (optional)
- returns
- An array of AddonInstalls
addInstallListener
Adds a listener that will be notified about any events in any install. The same listener will not be added multiple times.
- listener
- An InstallListener
removeInstallListener
Removes a previously added install listener.
- listener
- An InstallListener
getAddon
Gets an installed add-on.
TODO Make this asynchronous.
- id
- The ID of the add-on to retrieve
- returns
- An Addon representing the add-on or null if there is no installed add-on with the given ID
getAddons
Gets an array of the installed add-ons optionally restricting to a set of types.
TODO Make this asynchronous.
- types
- An array of types of add-ons to return (optional)
- returns
- An array of Addons representing the installed add-ons
addAddonListener
Adds a listener that will be notified about changes to add-on states for all installed add-ons. The same listener will not be added multiple times.
- listener
- An AddonListener
removeAddonListener
Removes a previously added add-on listener.
- listener
- An AddonListener
Addon
An Addon represents an instance of an installed add-on. It is a live view of the add-on.
id (string, readonly)
The ID of the add-on. No other installed add-on will have the same ID.
version (string, readonly)
The version of the add-on.
type (string, readonly)
The type of the add-on.
optionsURL (string, readonly)
The url of the options dialog to display for this add-on.
aboutURL (string, readonly)
The url of the about dialog to display for this add-on.
iconURL (string, readonly)
The url of the icon that represents this add-on.
isCompatible (boolean, readonly)
True or false depending on whether the add-on is compatible with the current version and platform of the application.
providesUpdatesSecurely (boolean, readonly)
True if the add-on has a secure means of updating.
satisfiesDependencies (boolean, readonly)
True if all requirements for this add-on are installed and enabled. TODO rename this to something better.
blocklistState (number, readonly)
The current blocklist state of this add-on.
appDisabled (boolean, readonly)
True if this add-on cannot be used in the application based on version compatibility, dependencies and blocklisting.
userDisabled (boolean)
True if the user wants this add-on to be disabled. TODO Make setting this asynchronous
isActive (boolean, readonly)
True if the add-on is currently functional. For some add-ons this will change immediately based on the appDisabled and userDisabled properties, for others it will only change after an application restart.
name (string, readonly)
The name of the add-on.
description (string, readonly)
The description of the add-on.
creator (string, readonly)
The creator of the add-on.
homepageURL (string, readonly)
The homepageURL of the add-on.
developers (string array, readonly)
The developers of the add-on.
translators (string array, readonly)
The translators of the add-on.
contributors (string array, readonly)
The contributors of the add-on.
pendingOperations (number, readonly)
A bitfield holding all of the current operations that are waiting to be performed for this add-on. Operations are generally deferred when a restart is necessary to accomplish them.
permissions (number, readonly)
A bitfield holding all the the operations that can be performed on this add-on. Operations my be restricted based on system policies (e.g. the system administrator may not allow certain add-ons to be uninstalled), add-on type (e.g. themes may not be disabled) or add-on state (e.g. an incompatible add-on cannot be enabled). TODO Rename this property.
uninstall
Uninstalls this add-on. If possible the uninstall will happen immediately otherwise it will wait until the next application restart. TODO This should be asynchronous.
cancelUninstall
Cancels uninstalling an add-on if it is pending uninstall.
findUpdates
Starts an update check for this add-on. This will perform asynchronously and deliver results to the given listener.
- listener
- An UpdateListener for the update process
- appVersion
- An application version to check for updates for (optional)
- platformVersion
- A platform version to check for updates for (optional)
AddonInstall
Represents an add-on installation through various states from being available through to being installed. Some of the properties may not be accurate depending on where the install came from and may change once the add-on has been downloaded and checked.
name (string, readonly)
The name of the add-on being installed.
version (string, readonly)
The version of the add-on being installed.
type (string, readonly)
The type of the add-on being installed.
state (number, readonly)
The state of the installation.
sourceURL (string, readonly)
The url that the add-on is being installed from.
file (nsIFile, readonly)
The file that the add-on is being installed from. This may be null if the add-on is coming from the internet and has yet to be downloaded.
progress (number, readonly)
The progress of any necessary download.
maxProgress (number, readonly)
The expected size of any necessary download or -1 if unknown.
addon (Addon readonly)
The add-on that this install will update if it is an update or null otherwise.
startDownload
Starts downloading the add-on if a download is necessary. Will notify the registered install observers during the download process.
startInstall
Starts installing the add-on. Will notify the registered install observers during the process.
AddonListener
AddonListeners are notified about changes to the state of add-ons. Certain state changes may not take effect until the next application restart.
onEnabled
Called when an add-on is enabled.
- addon
- The Addon that has been enabled
- needsRestart
- True if an application restart is necessary for the change to take effect
onDisabled
Called when an add-on is disabled.
- addon
- The Addon that has been disabled
- needsRestart
- True if an application restart is necessary for the change to take effect
onInstalled
Called when a new add-on has been installed. TODO Add an event specifically for upgrades.
- addon
- The Addon that has been installed
- needsRestart
- True if an application restart is necessary for the change to take effect
onUninstalled
Called when an add-on is uninstalled.
- addon
- The Addon that has been uninstalled
- needsRestart
- True if an application restart is necessary for the change to take effect
onOperationCancelled
Called when a pending operation for an add-on is cancelled.
- addon
- The Addon that has had a pending operation cancelled
UpdateListener
Notification about events during an update check for an add-on are passed to an update listener. onUpdateFinished will always be called.
onCompatibilityUpdated
Called when new compatibility information has been found for the installed version of an add-on.
- addon
- The Addon that was being checked for updates
onUpdateAvailable
Called when a new version of an add-on has been found for install.
- addon
- The Addon that was being checked for updates
- install
- An AddonInstall for the updated version
onUpdateFinished
Called when the update check is complete.
- addon
- The Addon that was being checked for updates
- error
- An error code or 0 if there was no error
InstallListener
An InstallListener is notified during add-on downloads and installs.
onDownloadStarted
Called when downloading begins for an add-on install. Only called for add-ons that need to be downloaded.
- install
- The AddonInstall representing the install
onDownloadEnded
Called when downloading ends for an add-on install. Only called for add-ons that need to be downloaded.
TODO Should the install continue or should the consumer need to call startInstall?
- install
- The AddonInstall representing the install
onDownloadFailed
Called if there is some error downloading the add-on. Only called for add-ons that need to be downloaded.
- install
- The AddonInstall representing the install
- error
- An exception representing the error
onInstallStarted
Called when installation of an add-on begins.
- install
- The AddonInstall representing the install
onInstallEnded
Called when installation of an add-on is complete. The newly installed add-on may require a restart in order to become active.
- install
- The AddonInstall representing the install
- addon
- The newly installed Addon
onInstallFailed
Called when there is a failure installing the add-on.
- install
- The AddonInstall representing the install
- error
- An exception representing the error