InstallListener

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.

InstallListeners are notified of an AddonInstall's progress. They may be registered to hear events from all AddonInstalls through addInstallListener or to a single AddonInstall through addListener.

Method Overview

void onNewInstall(in AddonInstall install)
void onDownloadStarted(in AddonInstall install)
void onDownloadProgress(in AddonInstall install)
void onDownloadEnded(in AddonInstall install)
void onDownloadCancelled(in AddonInstall install)
void onDownloadFailed(in AddonInstall install)
void onInstallStarted(in AddonInstall install)
void onInstallEnded(in AddonInstall install, in Addon addon)
void onInstallCancelled(in AddonInstall install)
void onInstallFailed(in AddonInstall install)
void onExternalInstall(in Addon install, in Addon existingAddon, in boolean needsRestart)

Methods

onNewInstall()

Called when a new instance of AddonInstall is created, primarily so UI can display some kind of progress for all installs.

void onNewInstall(
  in AddonInstall install
)
Parameters
install
The AddonInstall representing the install

onDownloadStarted()

Called when downloading begins for an add-on install. Only called for add-ons that need to be downloaded. A listener may return false to cancel the download.

void onDownloadStarted(
  in AddonInstall install
)
Parameters
install
The AddonInstall representing the install

onDownloadProgress()

Called as data is received during a download. Check the progress property for the amount of data downloaded and the maxProgress property for the total data expected. A listener may return false to cancel the download.

void onDownloadProgress(
  in AddonInstall install
)
Parameters
install
The AddonInstall representing the install

onDownloadEnded()

Called when downloading completes successfully for an add-on install. Only called for add-ons that need to be downloaded.

void onDownloadEnded(
  in AddonInstall install
)
Parameters
install
The AddonInstall representing the install

onDownloadCancelled()

Called when downloading is cancelled. Only called for add-ons that need to be downloaded.

void onDownloadCancelled(
  in AddonInstall install
)
Parameters
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.

void onDownloadFailed(
  in AddonInstall install
)
Parameters
install
The AddonInstall representing the install

onInstallStarted()

Called when installation of an add-on begins. A listener may return false to cancel the install.

void onInstallStarted(
  in AddonInstall install
)
Parameters
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.

void onInstallEnded(
  in AddonInstall install
  in Addon addon
)
Parameters
install
The AddonInstall representing the install
addon
The Addon addon that has been installed

onInstallCancelled()

Called when installation is cancelled.

void onInstallCancelled(
  in AddonInstall install
)
Parameters
install
The AddonInstall representing the install

onInstallFailed()

Called when there is a failure installing the add-on.

void onInstallFailed(
  in AddonInstall install
)
Parameters
install
The AddonInstall representing the install

onExternalInstall()

Called when an add-on is installed through some system other than an AddonInstall.

void onExternalInstall(
  in Addon addon,
  in Addon existingAddon,
  in boolean needsRestart
)
Parameters
addon
The newly installed Addon
existingAddon
An Addon that will be replaced by this install or null if no add-on is being replaced
needsRestart
True if the installation requires a restart

Document Tags and Contributors

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