Debugging Javascript in Firefox

I was playing around with PwdHash today, and I realized I couldn’t see the debug output (created with calls to the built-in function “dump()”). This was sufficiently complex to remedy that I’m making a note of it here.

Open a new tab and enter “about:config” for the address. Right click on any of the existing entries and select “New -> Boolean”. Create the following two booleans, set to true:


This ends up putting these two lines into prefs.js, which lives somewhere in your profile directory:

user_pref(“browser.dom.window.dump.enabled”, true);
user_pref(“javascript.options.showInConsole”, true);

Don’t edit that file while Firefox is running or your changes will be overwritten. Also, using this ‘about:config’ method causes your changes to take effect right away, so no need to restart (or lose all your tabs!). This output goes to the unix console (stdout or stderr), so make sure you run your browser from a terminal. The Error Console viewable from the Tools menu displays more sophisticated errors. I’m only interested in printf()-style output for now.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s