Setting Up the Development Environment

 < Day Day Up > 

First, the suggestions in this section are not absolute. You can install and configure Firefox differently and still be a successful extension developer. However, my experience has taught me that these steps are very useful in starting extension development.

I recommend a new, clean installation of Firefox. If Firefox is already installed, I recommend uninstalling it and checking to make sure the Firefox program folder has been deleted.

Next, delete your profiles! Back them up if you want, so you can later reinstall them, but for now, you will want a clean profile.

After you have uninstalled Firefox and cleared all your profiles, reinstall Firefox.

Now, your Firefox installation will have all components from the same installation source, thereby avoiding corrupt installation files. As well, because the profiles will be clean, you will be starting out clean.

After you have installed Firefox, launch it. Firefox will go to the default home page. In the Location bar, type about:config to go to the preferences configuration page. You will change several preferences to values that improve your development environment.


Generally, the only extensions you want installed in Firefox when developing are those that are specifically intended to assist you in creating your extension. Delete any other extensions.

Preferences for Extension Developers

In the about:config window, check the following preferences. Set them as indicated, and then restart Firefox. (Restarting ensures that your changes have taken effect.)

If you determine any preferences are missing during the Firefox installation, add them using about:config. Check the following preferences:

  • nglayout.debug.disable_xul_cache = true Setting this preference to TRue turns off the XUL cache. Any XUL changes made will not require that you restart Firefox.

  • browser.dom.window.dump.enabled = true Setting this preference to true causes the dump() statement to print to the JavaScript Console. You must restart Firefox with the console option to use this preference. Try creating a shortcut icon on your desktop with the console option added to the command line (see Figure 16.1).

    Figure 16.1. Set your Firefox console option as shown.

  • javascript.options.showInConsole = true This preference enables the JavaScript Console to log chrome errors.

  • javascript.options.strict = true With this preference, warnings are also sent to the JavaScript Console. This can generate more messages because warnings for all the extensions are sent to the JavaScript Console, not just those generated by your extension.

The two JavaScript preferences require that you run Firefox with the console for them to be useful. To start Firefox with the console active, modify your desktop shortcut to Firefox as shown in Figure 16.1. Add console after the final quotation mark in the Target string. If you add it before the final quotation mark, it will not work.


Of all these settings, nglayout.debug.disable_xul_cache is the most vital. Failing to disable the XUL cache can result in some very strange behavior when modifying your extension.

Now, start Firefox one final time. Check about:config to be sure your four development preferences are correctly set. Switch to the console and see what it looks like. Figure 16.2 shows the Firefox console during a run of Firefox.

Figure 16.2. The console is a separate window that looks a bit like a command session.


When javascript.options.strict=true is set, the console displays in addition to errors generated by your code errors that are generated by other code (such as other extensions). This is a good reason to not have any unnecessary extensions loaded while developing your extension.

     < Day Day Up > 

    Firefox and Thunderbird. Beyond Browsing and Email
    Firefox and Thunderbird Garage
    ISBN: 0131870041
    EAN: 2147483647
    Year: 2003
    Pages: 245

    Similar book on Amazon © 2008-2017.
    If you may any questions please contact us: