Firefox add-ons are generally grouped into Extensions, and then "other types" of Firefox add-ons.
Extensions allow Firefox to be customized by adding to or modifying the functionality of Firefox. Some of the types of things which can be done with extensions include:
Firefox add-ons, particularly extensions, are in a state of flux at the moment. Mozilla has announced, and confirmed, that they have deprecated all types of Firefox extensions, except WebExtensions, and that all non-WebExtensions based extensions will be disabled in Firefox 57, which is scheduled for 2017-11-14.
Firefox has four types of extensions (all of which are commonly referred to as add-ons):
WebExtensions use a significantly different API than the other three types of extensions. There is, intentionally, no ability to use the interfaces provided by any of the other add-on types.
Add-on SDK: [deprecated; scheduled for removal] These add-ons are described by a package.json file which is initially generated by executing
jpm init. These extensions will often use
jpm run or consolidated into an .xpi file by
jpm xpi for distribution (i.e. upload to AMO/Mozilla). In other words, they are bootstrapped extensions with an SDK wrapper.
Most of the things that can be done in a bootstrapped extension can be done in an Add-on SDK based one. However, many such things bypass the SDK which forfeits a significant portion of the benefits of using the Add-on SDK.
Bootstrapped: [deprecated; scheduled for removal] These extensions are also commonly called "restartless" because they were the first type of Mozilla extension which did not require the application to be restarted in order to load/unload the add-on. However, restartless is a descriptor of how they function. Using "restartless" as the name for this type of add-on is confusing because both Add-on SDK and WebExtension add-ons also do not require the application to be restarted upon load or unload of the add-on. For that reason, there is a tendency to no longer use "restartless" as the name for this type of add-on.
These add-ons contain a install.rdf file that describes the add-on. They usually, but not always, also contain a chrome.manifest file that describes how the files and directories in the extension relate to the Mozilla application (e.g. Firefox).
Mozilla has stated that they plan to deprecate "add-ons that depend on XUL, XPCOM, and XBL." While not all bootstrapped add-ons depend on these technologies, there is a tendency for for bootstrapped add-ons to operate at a lower level than Add-on SDK and WebExtension add-ons. Thus, they are more likely to use these technologies. While there are some that are saying that all bootstrapped add-ons are planned to be deprecated, it is not clear that is the case. After all, Add-on SDK extensions are not being deprecated (unless they use
require("chrome"), or otherwise depend on XUL, XPCOM, or XBL) and all Add-on SDK extensions are bootstrapped extensions, just with an SDK wrapper.
Overlay/XUL/Legacy: [deprecated; scheduled for removal] These add-ons contain a install.rdf file that describes the add-on and a chrome.manifest file to describe how the add-on's files relate to (e.g. overlay) the application's files. How the add-on functions with the application is completely dependent on the relationships described in the chrome.manifest file. The only exceptions to this are a few things like icons for the extension and the file describing the extension's options which are indicated in the install.rdf file. These extensions interact with the application (e.g. Firefox) at a very low level. This tends to make them more likely to break when changes are made to the application.
All Overlay/XUL/Legacy extensions are planned to be deprecated.
When most people think about Firefox add-ons they are thinking about the extensions described above. However, there are some additional types of Firefox add-ons:
This "example" is primarily copied, with some modifications, from my, Makyen's, answer on a stackoverflow question.
Some portions of this content were copied, or at least based upon, the Add-on page on Mozilla Developer Network (MDN).
This was originally posted by Makyen in the "Remarks" section of the firefox-addon tag. It was then modified by Ondřej Doněk, who removed an extra "for ". In a single edit performed by nus, it was moved from "Remarks" to a pinned "example" titled "Introduction". Unfortunately, doing so resulted in the system loosing attribution information.