Skip to main content
Submitted by Xenoveritas on
Topics

OK, this is one of those "to be edited later" posts, but it's a start at writing a real quick tutorial on how to write a Firefox extension.

Settings Up Firefox

Before writing any code, we need to set up Firefox to make debugging an extension more possible. I mean, we could conceivably skip these steps, but then debugging anything would be a giant pain.

Anyway, first things first. Copy your Firefox shortcut or launcher or whatever you use for your system. Edit it and add "-console" to the command that starts it. So Windows users will wind up with something like:

"C:\Program Files\Mozilla Firefox\firefox.exe" -console

That will enable the console window to appear when you run Firefox, which will display console messages that you can create using "window.dump()" from within your JavaScript code. Of course, that doesn't actually enable window.dump(), so you won't see anything yet.

The next step is to pop over to about:config and right click on it to add the following key: "browser.dom.window.dump.enabled" Set that to "true."

Unfortunately, JavaScript errors in your extension will still be silently absorbed. So now filter on "javascript.options.showInConsole" and set that to true.

You've now got Firefox in configured so that it makes it much nicer for development. You can write debugging messages using window.dump() and find JavaScript errors in the JavaScript console.

I'll update this with more at some later point.