SearchCallback

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.

SearchCallbacks are notified when the AddonRepository search completes. If the search succeeded, then searchSucceeded() is called and is passed an array of Addon objects that matched the search. Since these Addons are not actually installed, the AddonManager does not know about them. However, for each returned add-on, an AddonInstall object is created, which the AddonManager does know about. Each AddonInstall can be accessed through the Addon install attribute, and is initially in the STATE_AVAILABLE state. The array of Addons passed to  searchSucceeded() only includes add-ons that are compatible with the current application and are not already installed or being installed. The AddonRepository is available for another search once one of the callback functions is called.

Method Overview

void searchSucceeded(in Addon addons[], in integer addonCount, in integer totalResults)
void searchFailed()

Methods

searchSucceeded()

Called when a successful search completes.

void searchAddons(
  in Addon addons[],
  in integer addonCount,
  in integer totalResults
);
Parameters
addons
Array of Addon objects representing the add-ons found by the search. The array represents a subset of the total add-ons available in the repository that match the search.
addonCount
The number of add-ons returned. Note, addons.length == addonCount.
totalResults
The total number of results available in the repository.

searchFailed()

Called when a search results in failure. A new search will immediately fail if AddonRepository is completing another search request.

void searchFailed();
Parameters

None.

See also

Document Tags and Contributors

 Contributors to this page: wbamberg, bunnybooboo, Sheppy, bparr
 Last updated by: wbamberg,