This article provides suggestions for how to set up your Mozilla application for extension development. These details apply to Firefox, Thunderbird, and SeaMonkey (version 2.0 and above).

Overview

Development profile

The use of a separate user profile for development can be advantageous, averting performance degradation from development related settings, and further isolating personal data (such as bookmarks, extensions, and settings) from your testing environment. You could be running two instances of Firefox simultaneously.

Note: For an extended guide on how to set up even more user profiles, take a look at Multiple Firefox profiles. This particularly comes in handy for the use of all currently available Firefox versions. It even allows the running of simultaneous versions, at the same time.

To quickly achieve our task of creating just a developer profile, we will start the application with the parameters:

/path/to/Firefox -no-remote -P ProfileName

Without these parameters, the default behavior of your Mozilla applications is to only open the everyday user profile: named default. As we are specifically defining the user profile dev, If you don't have the dev profile already created, the profile selection window opens, where you can create it.

In the following example, the described command starts a new instance of Firefox, with a profile called dev; even if an instance of Firefox is already running.

On Ubuntu (and many other Linux distributions):

/usr/bin/firefox -no-remote -P dev

On other distributions of Linux/Unix:

/usr/local/bin/firefox -no-remote -P dev

On MacOS Mavericks (10.9) and newer:

/Applications/Firefox.app/Contents/MacOS/firefox-bin -no-remote -P dev &

On Windows:

Start -> Run "%ProgramFiles%\Mozilla Firefox\firefox.exe" -no-remote -P dev

On Windows 64 bit:

Start -> Run "%ProgramFiles(x86)%\Mozilla Firefox\firefox.exe" -no-remote -P dev

To start Thunderbird or SeaMonkey instead of Firefox, substitute thunderbird, or seamonkey for the firefox used in our examples.

Note: you could run Firefox using your regular profile while developing. However, you won't enjoy the benefits of isolated resources, which we discussed earlier.

The Parameter -P ProfileName doesn't imply -no-remote, therefore use them together. If you are already running a Firefox instance without -no-remote, and you attempt to start another instance with -P ProfileName (but without the -no-remote parameter), that second invocation would ignore its -P ProfileName parameter, instead opening a new window for the already running instance; sharing all its profile, sessions etc.

Download Firefox

Download your desired version of Firefox. Unpack them in your user home directory, and name folders for easy navigation to firenightly and firedevedition or similar. You do not have to install these unstable versions, if you do not wish.

Make a symbolic link (also referred to as a shortcut) to the firefox binary (firefox.exe on Windows), then move the link to your desktop, or your preferred location. To run this version of Firefox, simply double click on this file. Explore this profile a little: change some settings, install any additional extensions, and finally close this instance of Firefox.

Now run your Firefox Profile Manager. (Linux, Mac OS X, Windows instructions.) You'll see the list of available user profiles one which is default (stable) and other (unstable) profile(s) created automatically when you run other versions of Firefox earlier. Choose default and uncheck "Don't ask at startup" checkbox. Click "Start Firefox". Now when you start any version of Firefox you may choose any profile you like.

Development command flags

As of Gecko 2 (Firefox 4), JavaScript files are cached ("fastload"). The -purgecaches command-line flag disables this behavior. Alternatively, you can set the MOZ_PURGE_CACHES environment variable. See this bug for more information.

Development preferences

There is a set of development preferences that, when enabled, allows you to view more information about application activity, thus making debugging easier. However,  these preferences can degrade performance, so you may want to use a separate development profile when you enable these preferences.

Accessing Firefox development preferences

To change preference settings in Firefox or SeaMonkey, type about:config in the Location Bar. You can also use the Extension Developer's Extension, which provides a menu interface for Firefox settings.

Accessing Thunderbird development preferences

To change preference settings in Thunderbird, open the "Preferences" (Unix) or "Options" (Windows) interface. On the "Advanced" page, select the "General" tab then click the "Config Editor" button.

Not all preferences are defined by default, and are therefore not listed by default. You will have to create new (boolean) entries for them. For more information about Mozilla preferences, refer to the mozillaZine article on "about:config".

Tip: You can install either the Developer Profile or DevPrefs add-ons to handle setting these preferences automatically, and skip the rest of this section.

DevPrefs can now be found at https://github.com/Noitidart/DevPrefs. maxVersion needs to be set in install.rdf

Warning: Never set nglayout.debug.disable_xul_fastload to true in a production environment; it exists solely to aid in debugging. In particular, add-ons should never change this preference.

Note: The Error Console is disabled by default starting in Gecko 2.0. You can re-enable it by changing the devtools.errorconsole.enabled preference to true and restarting the browser. With this, javascript.options.showInConsole is also set to true by default.

Development extensions

These extensions may help you with your development.

Firefox extension proxy file

Extension files are normally installed in the user profile. However, it is usually easier to place extension files in a temporary location, which also protects source files from accidental deletion. This section explains how to create a proxy file that points to an extension that is installed in a location other than the user profile.

  1. Get the extension ID from the extension's install.rdf file.
  2. Create a file in the "extensions" directory under your profile directory with the extension's ID as the file name (for example "your_profile_directory/extensions/{46D1B3C0-DB7A-4b1a-863A-6EE6F77ECB58}"). (How to find your profile directory) Alternatively, rather than using a GUID, create a unique ID using the format "name@yourdomain" (for example chromebug@mydomain.com) - then the proxy filename will be same as that ID, with no curly brackets {}.
  3. The contents of this file should be the path to the directory that contains your install.rdf file, for example /full/path/to/yourExtension/ on Mac and Linux, and C:\full\path\to\yourExtension\ on Windows. Remember to include the closing slash and remove any trailing whitespace.

  4. Place the file in the extensions folder of your profile and restart the application.

Using directories rather than JARs

Regardless of whether you choose to eventually package your extension's chrome in a JAR or in directories, developing in directories is simpler. If you choose a JARed structure for releasing, you can still develop with a directory structure by editing your chrome.manifest. For example, rather than having

content	myExtension	jar:chrome/myExtension.jar!/content/

use

content	myExtension	chrome/content/

 

Preventing the first launch extension selector

Requires Gecko 8.0(Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5)

 

Starting in Firefox 8, on the first launch of a new version of Firefox, it presents user interface letting users select which third party add-ons to keep. This lets them weed out add-ons that were installed without their knowledge, or that are no longer needed.

However, this interface can be disruptive when debugging add-ons. You can avoid this by setting the preference extensions.autoDisableScopes to 14.