MozillaZine

Packaging extensions

From MozillaZine Knowledge Base

(Difference between revisions)

Asqueella (Talk | contribs)
(put packaging info from main page here)
Next diff -->

Revision as of 19:13, 28 August 2005

This page is part of the extension development documentation project.

Ask your questions in MozillaZine Forums. Also try browsing example code.

Note: development documentation is in process of being moved to Mozilla Development Center (MDC).


With .jar file

Mozilla.org provides the most comprehensive technical document on packaging extensions. It explains the format of the install.rdf file for those wishing to create one from scratch. However, there also are tools and templates for easier creation of the install.rdf file.

The Extension Manager—and hence the extension/theme packaging system—underwent a major revision with Firefox 0.9 and Thunderbird 0.7. If you wish to support earlier versions of these products, or the Mozilla Suite, you will need to provide the old-style install.js file as well as the new install.rdf.

The whole process for the new packaging system is made clear in both roachfiend’s tutorial and Jonah Bishop's toolbar tutorial. The tutorial on XulPlanet covers the old system (most of this tutorial also applies to new-style extensions too). Jed Brown also has a tutorial on repackaging old extensions in the new style.

There are also tools which will automatically package your extension files: a bash build script, Windows build script, Googlebar Lite Perl build script, a makefile.

without .jar file

While developing your Extension it can make sense not to .jar files but to use them directly instead. That way you can debug in the extensions directory of a usersprofile directly without re-packing and re-jaring. Creating a package without a .jar file is the same like described above with only some changes:

  • Use a directory instead of a JAR:
    Instead of packing your files into a file called chrome/myextension.jar you copy them into a directory called chrome/myextension
  • Change the install.rdf:
    Change it from:
    <Description about="urn:mozilla:extension:file:myextension.jar">
    to:
    <Description about="urn:mozilla:extension:file:myextension">
  • Change the install.js:
    For Mozilla Suite there might be additional modifications in the install.js file necessary which reflect the install.rdf file changes which is replaced by the .js file. It is unknown if this applies to Firefox or Thunderbird, too.

More: Getting rid of JARs (Tip & Example). Please note, that it's recommended to package chrome files in a JAR, for better startup performance.