Mozile : 0.6 Series for Firefox 2.0

Development

Page Contents

  1. Mozile Packages
  2. Mozile XPI
  3. Mozile For Firefox
  4. Mozile CVS
  5. Mozile Debugging
  6. Mozile Testing

Mozile Packages

Mozile is available in two packages.

The code is the same in both packages. The developer's version contains additional documentation and resources for those who wish to customize Mozile to suit their own requirements.

Mozile XPI

XPI stands for Cross-Platform Installer (pronounced "zippy"), and XPI files are used to install Firefox extensions. An XPI file is simply a ZIP file that includes installation instructions. You can unzip the XPI if you wish to look at any of the files used by the Mozile extension.

For more information on developing and debugging extensions with Firefox refer to the following pages:
http://developer.mozilla.org/en/docs/Extensions
http://developer.mozilla.org/en/docs/Building_an_Extension

Mozile For Firefox 2.0

Extensions are installed in a directory called "extensions" in the user's profile, and each one is kept in its own subdirectory. The individual subdirectories are labelled with the extension's unique identifying code or name.

Mozile's name is : {mozile@mozile.mozdev.org}

Inside the extensions directory is a file called "Extensions.rdf" that contains information on each of the installed extensions. Inside Mozile's directory are files named "install.rdf" and "chrome.manifest" that contain all of the information about the extension, and a directory called "chrome" that contains all of the files used by Mozile. The "chrome" directory contains subdirectories called "content", "locale", and "skin". All of Mozile's files are contained in these directories. You can edit these files, and after Firefox restarts you will see the changes to Mozile.

To switch between the standard and developer's versions of Mozile, uninstall your current version using the "Tools" » "Add-ons" dialog, restart Firefox, and then install the new version. Updating from an old stable to a new stable version (or an old developer's version to a new one) will not require you to uninstall Mozile first.

Mozile CVS

The Mozile CVS can be accessed on the web (using CVSWeb) at:
http://www.mozdev.org/source/browse/mozile/.
It can also be accessed using a CVS client, following the instructions here:
http://www.mozdev.org/docs/start.html#content2

Here is a quick summary of anonymous CVS access. Login as guest (password is guest) using the following command:
cvs -d :pserver:guest@mozdev.org:/cvs login

Then check out a copy of Mozile using:
cvs -d :pserver:guest@mozdev.org:/cvs co mozile

The source files for the 0.6 Series can be found in the following directory:
mozile\source\extension\mozile-0.6\

Note that the DEVEL branch of the tree is no longer being used.

Mozile Debugging

Debugging any extension is a tricky thing. In order for changes to take effect the browser will have to be restarted, so that the chrome files can be reloaded. This can be tedious.

Javascript : strict

Another problem is that errors in chrome JavaScript are not as well reported as in normal pages. It is recommended to switch on the strict Javascript error reporting preference to help with correcting faulty code. Type "about:config" into the browser address bar to show all the preferences. In the Filter type "javascript" to show all the Javascript preferences. Set "javascript.options.strict" to "true" if it currently set to "false". Normal Mozile code is written to the strict standards and should not produce any errors or warnings. If you see any, please report them as a bug.

mozileDebug()

Mozile has it's own inbuilt debugging system. By default it is turned off, but by changing "Settings » Debugging Level" to "Minimal Debugging" or "Full Debugging" the given degree of debugging will be enabled. Important debugging messages appear in the Status bar of the current window. You can click on the Bug button in the Mozile toolbar to show a complete list of debugging messages.

If there is a function that you want to debug inside Mozile, or you wish to set an "Alert" trap when a piece of code is executed, then it is best to add a call to the mozileDebug() function.

Venkman Debugger

Venkman, the JavaScript debugger, can be a lot of help once you learn how to use it. So can the DOM Inspector, which is built in to both Mozilla and Firefox.

Venkman is particualrly good at finding errors that don't show up in the Javascript Console. Disable all your other extensions (because they often produce lots of errors...) and set up Venkman to stop on an error or when an exception is thrown. When you hit an error you can examine the local variables, step through the code, or set future break points.

Mozile Testing

JsUnit

JsUnit is used for some automated tests. If you have the developer's version of the Mozile XPI installed then you can go to the testing directory for details of how to install JsUnit and run the tests.

The test units have not been updated for a while and may not work.

JSDoc

Parts of the code are documented for use with JSDoc. In particular, it helps to run the eDOM files through JSDoc to produce a reference of all the properties and methods. At some point, the JSDoc output will be added to the developer docs. Further info can be found at the JSDoc homepage:
http://jsdoc.sourceforge.net/

Setting up a local development environment

A useful development trick is to create a file called "mozile@mozile.mozdev.org" in the extension directory containing a path to the mozile files; Point to the directory containing the "chrome" directory and install files. The path can point to any suitable location on your local disk. By changing the path you can easily swap between different versions of Mozile.