This is an archived page. It's not actively maintained.



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 (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.


To follow this tutorial you'll need to have learned the basics of jpm.

The DOM console object is useful for debugging JavaScript. Because DOM objects aren't available to the main add-on code, the SDK provides its own global console object with most of the same methods as the DOM console, including methods to log error, warning, or informational messages. You don't have to require() anything to get access to the console. It is automatically made available to you.

The console.log() method prints an informational message:

console.log("Hello World");

Try it out:

  • create a new directory, and navigate to it
  • execute jpm init, accepting all the defaults
  • open "index.js" and add the line above
  • execute jpm run

Firefox will start, and the following line will appear in the command window you used to execute jpm run:

info: Hello World!

console in Content Scripts

You can use the console in content scripts as well as in your main add-on code. The following add-on logs the HTML content of every tab the user loads, by calling console.log() inside a content script:

require("sdk/tabs").on("ready", function(tab) {
    contentScript: "console.log(document.body.innerHTML);"

console Output

If you are running your add-on from the command line (for example, executing jpm run or jpm test) then the console's messages appear in the command shell you used.

If you've installed the add-on in Firefox then the messages appear in Firefox's Browser Console.

But note that by default, calls to console.log() will not result in any output in the Error Console for any installed add-ons: this includes add-ons installed using the Add-on Builder or using tools like the Extension Auto-installer.

See "Logging Levels" in the console reference documentation for more information on this.

Learning More

For the complete console API, see its API reference.