mike chambers | about

Debugging Thunderbird Extensions on OS X

Thursday, December 9, 2004

Well, now that I have gotten my first FireFox extensionworking, I decided to see if I could make it run within Thunderbird. The first issue I ran into was trying to figure out how to debug extensions within Thunderbird. It took me a while to figure it out, but it is pretty much the same as in FireFox.

First, you have to set the following Thunderbird preference to true:

browser.dom.window.dump.enabled

However, there is not an easy way (such as FireFox’s about:config) to set the preference. In order to set it, you need to add the following line to your user.js file in your Thunderbird profile directory:

user_pref("browser.dom.window.dump.enabled", true);

If the file doesn’t exist (it doesn’t by default), just create it. You can find more info on setting Thunderbird preferences here.

This setting will redirect dump() statements from your extension to the console.

In order to view the dump statements, you have to start Thunderbird from the console / terminal. You can do this on OS X with the following command line (replace the path to match your system):

/Applications/Thunderbird.app/Contents/MacOS/thunderbird-bin

Now, if you add:

debug("Hello World\n");

To you extension, then you will see:

Hello World

output to the console / terminal that you started Thunderbird from.

You can now debug Thunderbird extensions the same way you debug FireFox extensions.

twitter github flickr behance