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.

Starting from Firefox 53, no new legacy add-ons will be accepted on addons.mozilla.org (AMO) for desktop Firefox and Firefox for Android.

Starting from Firefox 57, only extensions developed using WebExtensions APIs will be supported on Desktop Firefox and Firefox for Android.

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 use WebExtensions APIs if they can. See the "Compatibility Milestones" document for more information.

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

The Add-on Repository is responsible for finding available add-ons; it provides an interface for interacting with the addons.mozilla.org (AMO) site. Its API provides URLs that can be visited to browse the repository's add-ons. The API also offers two ways to search for and retrieve an array of Addon instances: retrieveRecommendedAddons(), which returns a list of recommended add-ons, and searchAddons(), which performs a search of the repository.

These searches are asynchronous; results are passed to the provided SearchCallback object when the search is completed. Results passed to the SearchCallback object only include add-ons that are compatible with the current application and are not already installed or in the process of being installed. AddonRepository can only process one search at a time. A new search will immediately fail if the AddonRepository is already handling another search request.

To import the Add-on Repository code module, use:

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

Method overview

string getRecommendedURL()
string getSearchURL(in string searchTerms)
void cancelSearch()
void retrieveRecommendedAddons(in integer maxResults, in SearchCallback callback)
void searchAddons(in string searchTerms, in integer maxResults, in SearchCallback callback)

Properties

Property Type Description
homepageURL string The URL of the repository site's home page.
isSearching boolean true if a search is currently in progress; otherwise false.

Methods

getRecommendedURL()

Returns the URL that can be visited to see recommended add-ons.

string getRecommendedURL();
Parameters

None.

Return value

An URL indicating the repository's page of recommended add-ons.

getSearchURL()

Returns an URL of a web page that can be visited to see search results for the specified search terms.

string getSearchURL(
  in string searchTerms
);
Parameters
searchTerms
Search terms used to search the repository.
Return value

The URL of the search results page for the specified search terms.

cancelSearch()

Cancels the search in progress. Does nothing if there is no search in progress.

void cancelSearch();
Parameters

None.

retrieveRecommendedAddons()

Begins a search for recommended add-ons in the repository. The list of recommended add-ons frequently changes. Results will be passed to the given SearchCallback callback.

void retrieveRecommendedAddons(
  in integer maxResults,
  in SearchCallback callback
);
Parameters
maxResults
The maximum number of results to return.
callback
The SearchCallback callback to which results will be delivered.

searchAddons()

Begins a search for add-ons in this repository. Results will be passed to the given callback.

string searchAddons(
  in string searchTerms,
  in integer maxResults,
  in SearchCallback callback
);
Parameters
searchTerms
The search terms to pass to AMO. The results will match what you would get if you typed this string in the search box on the AMO web site.
maxResults
The maximum number of results to return.
callback
The SearchCallback callback to pass results to.

See also