Brain Flush

January 17, 2008

Mozilla Thunderbird Extension Development – Environment Setup

It took me a while to setup my Thunderbird installation in order to make it ready for convenient extension development, by which I mean having all the tools and configuration in place. So I thought I’d share the most useful steps you want to perform in order to make your life easier.

You should basically do two things: One, reconfigure Thunderbird to be more developer-friendly, and two, install some cool extensions.

First, I recommend installing the following plugins:

  1. ChromEdit Plus – allows for easy access to your configuration files. Works in Firefox, too.
  2. Venkman – A JavaScript debugger. Must have. For Firefox, I recommend Firebug instead.
  3. Console² – An advanced error console. Can interpret JavaScript commands on-the-fly.
  4. Chrome List – Lets you inspect chrome packages of all installed components. It’s somewhat buggy for me though, sometimes the contents of XUL files are not displayed in the viewer.

With these plugins installed, you already have a solid basis to built your hacking on.

Now to the configuration. You can do this with ChromEdit now, or if you haven’t installed it, fall back to your favorite text editor. Open the ChromEdit Plus menu, select ChromEdit and navigate to the ‘user.js’ tab. From here you can edit your ‘user.js’ file located in your profile folder (on Linux, it’s in your home directory, on Windows, it’s in ‘Documents and Settings/<username>/Application Data/Thunderbird/Profiles/<long_UUID>’ ). If it does not yet exist, and it doesn’t by default, go ahead and create it). Add the following lines (it’s a JavaScript file, so it’s simply JavaScript syntax):

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

The following explanations are taken from the MDC:

  • javascript.options.showInConsole = true. Logs errors in chrome files to the Error Console.
  • nglayout.debug.disable_xul_cache = true. Disables the XUL cache so that changes to windows and dialogs do not require a restart. This assumes you’re using directories rather than JARs. Changes to XUL overlays will still require reloading of the document overlaid.
  • browser.dom.window.dump.enabled = true. Enables the use of the dump() statement to print to the standard console. See window.dump for more info. You can also use nsIConsoleService from privileged script.
  • javascript.options.strict = true. Enables strict JavaScript warnings in the Error Console. Note that since many people have this setting turned off when developing, you will see lots of warnings for problems with their code in addition to warnings for your own extension. You can filter those with Console2.

In order for the Thunderbird standard console to appear, run Thunderbird with the ‘-console’ command line argument. The dumped statements won’t appear in Console² though.

You may also want to refer to Setting up extension development environment on MDC as a primer, I particularly recommend the steps outlined for externalizing your development files into a separate folder, so you won`t have to reinstall the plugin each time you change a line of code.

Advertisements

2 Comments »

  1. […] My research hasn’t gone far as I got side tracked with the idea of building an extension for Thunderbird specifically for mail backup. All of this daydreaming prompted a new question altogether: How do you set up Thunderbird for extension development? If you’ve been thinking about the very same question, check out this post over at Brain Flush where the author details what you need to set up your Thunderbird installation specifically for extension development. […]

    Pingback by TechTraction » Friday Finds for 05/09/2008: Setting Up Thunderbird for Extension Development — May 9, 2008 @ 7:03 am


RSS feed for comments on this post. TrackBack URI

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: