mozdev.org

Mozile (xhtml editing in your browser)    

resources:

Welcome to Mozile, the WYSIWYG XHTML editor for Mozilla! This document describes the various tricks used to develop Mozile.

Documents

  1. Mozile Documentation - A General Introduction to Mozile
  2. Mozile Development - Notes on the Development of Mozile
  3. Mozile Content - Notes on the Code behind Mozile
  4. Mozile Locale - Notes on the Localization of Mozile
  5. Mozile Skin - Notes on the Styling of Mozile

Contents

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

Mozile Development

Mozile Packages

Mozile has two different levels of development, and is packaged in two different ways. The first level is the stable branch, and the second is the development branch. We hope that the stable branch has very few bugs, while the development branch is the place for additional features to be added and tested. The installation files for the stable version are named "mozile-[Version].xpi" while the installation files for the development version are named "mozile-[Version]-devel.xpi".

The stable version is packaged neatly into a JAR archive, and installed into either the browser's chrome directory, or the chrome directory of the user's profile. The decision as to where Mozile is installed is made by the user during installation. The development version of Mozile is not packaged into a JAR archive, it is just a normal directory full of files. The develpment version is installed in the same location as the stable version (the browser or user chrome directory).

Only one of these version can be used at a time. See the notes for your platform (Firefox or Mozilla) for information about switching between the stable and development versions.

Mozile XPI

XPI stands for Cross-Platform Installer, and XPI files are used to install Mozilla and Firefox extensions. An XPI file is simply a ZIP file which includes installation instructions. The instructions are written in the JavScript file install.js, which Mozilla looks for when asked to install. More details can be found in Chapter 6 of Creating Applications with Mozilla.

Mozile For Firefox

Since Firefox 0.9 the extension management system has been significantly improved. 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. Mozile's code is "{6c3be43a-bf98-11d8-ab4c-000a95cfe02a}".

Inside the extensions directory is a file called "Extensions.rdf" which contains information on each of the installed extensions. Inside Mozile's directory is a file named "install.rdf" which contains all of the information about the extension, and a directory called "chrome" which contains all of the files used by Mozile.

If you have installed the stable version of Mozile, then the "chrome" directory will contain a single file called "mozile.jar". A JAR file is just another kind of ZIP file, and this one compresses all of the Mozile files. If you want to make changes to the stable version of Mozile installed on your system, you will have to unpack the JAR archive, make your changes, then package it again, and replace the old mozile.jar file. The mozileBuild script can help with this; it's available in Mozile CVS here http://www.mozdev.org/source/browse/mozile/source/extension/package/mozileBuild.

If you are using the development version, then the "chrome" directory will 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 stable and development versions of Mozile, simply uninstall your current version using the "Tools"->"Extensions" dialog, restart Firefox, and then install the new version. Updating from and old stable to a new stable version (or and old development version to a new one) will not require you to uninstall Mozile first.

Mozile For Mozilla

Although Mozile should work the same on both FIrefox and Mozilla, there are major differences in the way that extensions are stored and loaded.

The stable version of Mozile is packaged in a JAR archive inside the XPI file. A JAR archive is just another kind of ZIP file, with a few additions like a manifest. The XPI install process for the stable version will place the mozile.jar file (containing all of Mozile's files) into the appropriate chrome directory.

If you want to make changes to the stable version of Mozile installed on your system, you will have to unpack the JAR archive, make your changes, then package it again, and replace the old mozile.jar file. The mozileBuild script can help with this; it's available in Mozile CVS here http://www.mozdev.org/source/browse/mozile/source/extension/package/mozileBuild. The alternative is to unpack Mozile into a sub-directory of the chrome directory, like the development version does by default. This will save you the tedious steps of unpacking and repacking the JAR archive, but it requires a few modifications to the chrome registry.

The chrome.rdf file is what tells Mozilla where to find the files for all the installed extensions. There are copies of the chrome.rdf file in each chrome directory, but we are only interested in the one which is associated with the Mozile installation. This will be in the user's chrome directory, if Mozile was installed for a specific user, and in the browser's chrome directory is Mozile was installed for all users at once.

Here are the steps needed to convert a JAR installation into a directory installation:

  • Find the mozile.jar file in the appropriate chrome directory.
  • Unpack the mozile.jar file into a sub-directory called "mozile".
  • Open the chrome.rdf file in the same chrome directory.
  • Search through the chrome.rdf file for attributes called "c:baseURL". These are URL paths which contain "mozile.jar!" in them. They will begin with "jar:file:///". There should be three instances, one each for "content", "skin", and "locale".
  • In each of the three cases, replace "mozile.jar!" with "mozile", and replace "jar:file:///" with "file:///".
  • You're done!

To convert a directory installation into a JAR installation, just package the "mozile" directory into a "mozile.jar" file, and perform the replacements on those three lines in reverse.

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

Mozile currently has two CVS branches, one called MAIN and one called DEVEL. These are for the stable and development versions respectively. To check out a copy of the DEVEL source, use one of the following commands:

cvs -d :pserver:guest@mozdev.org:/cvs co -r DEVEL mozile

Or:

cvs -d :pserver:guest@mozdev.org:/cvs update -r DEVEL mozile

Mozile Debugging

Debugging any Mozilla 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.

Another problem is that errors in chrome JavaScript are not as well reported as in normal pages. Mozile has recently implemented it's own debugging system, however, which should make things easier. 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.

Most 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, then it is best to add a call to the mozileDebug() function.

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. We are developing a suite of JsUnit tests, which will also be helpful, see below.

For more information on developing and debugging extensions, see this page http://kb.mozillazine.org/index.phtml?title=Dev_:_Extensions.

Mozile Testing

We are developing an automated test suite for Mozile and eDOM. We use JsUnit to put Mozile through its paces. If you have the developer's version of the Mozile XPI installed then you can go to chrome://mozile/content/testing/mozileTesting.xml and try it out.

It will take some time before all of Mozile's code has proper tests written for it, but if you write new code it would be great if you could include a test page for it.

James A. Overton - http://mozile.mozdev.org - 2004-06-20

The mozile project can be contacted through the mailing list or the member list.
Copyright © 2000-2019. All rights reserved. Terms of Use & Privacy Policy.