Support for extensions using XUL/XPCOM or the Add-on SDK was removed in Firefox 57, released November 2017. As there is no supported version of Firefox enabling these technologies, this page will be removed by December 2020.

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 Manager is responsible for managing all of the add-ons installed in the application. Through its APIs information about all installed add-ons can be retrieved and new add-ons can be installed. The APIs are designed to be generic and support many different types of add-ons.

Many functions in the Add-on Manager interface operate asynchronously returning results through callbacks passed to the functions. The callbacks may be called immediately while the initial function is still executing or shortly after, depending on when the requested data becomes available.

Accessing installed add-ons

Information about installed add-ons can be retrieved through the main AddonManager API. All of its functions are asynchronous, meaning that a callback function must be passed to receive the Addon instances. The callback may well only be called after the API function returns. For example:

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

AddonManager.getAllAddons(function(aAddons) {
  // Here aAddons is an array of Addon objects
});
// This code will execute before the code inside the callback

Notifications about changes to installed add-ons are dispatched to any registered AddonListeners. They must be registered through the addAddonListener() method.

Installing new add-ons

New add-ons can be installed by using the getInstallForFile() or getInstallForURL() methods on the AddonManager object. These will pass an AddonInstall instance to the callback, which can then be used to install the add-on:

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

AddonManager.getInstallForURL("http://www.foo.com/test.xpi", function(aInstall) {
  // aInstall is an instance of AddonInstall
  aInstall.install();
}, "application/x-xpinstall");

The progress of AddonInstalls can be monitored using an InstallListener. A listener can be registered either for a specific install using the addListener() method or for all installs using the addInstallListener() method.

Finding updates

Add-ons can be checked for updates using the findUpdates() method. It must be passed an UpdateListener to receive information about compatibility information and new update information. Any available update is returned as an AddonInstall which is ready to be downloaded and installed.

Detecting add-on changes

Requires Gecko 7.0(Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4)

You can also get lists of add-ons that, at startup, were changed in various ways. The getStartupChanges() method lets you find out which add-ons were installed, removed, updated, enabled, or disabled at application startup.

For example, to take a look at the add-ons that were disabled at startup:

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

let addonIDs = AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_DISABLED);
if (addonIDs.length > 0) {
  // addonIDs is now an array of the add-on IDs that have been disabled
alert("Note: " + addonIDs.length + " add-ons have been disabled.");
}

Open Add-on Manager Tab

The add-on manager tab can be opened programatically with the function BrowserOpenAddonsMgr which is available on chrome window of "navigator:browser" type. You can pass the url to a page in the add-on manager tab to load that page.

Read more about it at this topic here on Mozilla Add-ons Forum :: How to open an add-on's preference panel? and also here MDN :: Inline options - Opening Inline Options in Add-on Manager. These pages show you how to load pages such as services page etc.

See also