FirefoxExtensions@bolinfest.com

www.bolinfest.com

Build Your Own

This is not a tutorial on writing Firefox extensions because there are already good ones out there on the web (see below). Here I give references to full tutorials, and then provide my own tips about tools and publishing that are not covered in the tutorials.

Tutorials

Note: At the time of this writing, the resources for creating Firefox extensions seem to be strewn about the web. Hopefully they will be consolidated by the Firefox people at some point in the near future. (8/23/04)

Mozilla.org has a tutorial on how to create extension for the Mozilla web browser, which was the precursor to the Firefox web browser. Writing an extension for Mozilla is similar to writing an extension for Firefox, but there are some small differences. As this is currently the only official tutorial on the Mozilla/Firefox web site, it is still a good place to start.

The makers of the BugMeNot Firefox extension wrote up their own tutorial for creating Firefox extensions. This is a good tutorial that works through a working example (BugMeNot), so I strongly recommend it.

Every Firefox extension needs an install.rdf file to describe its contents. The only place on the web that seems to explain the install.rdf file format in its entirety is at Ben Goodger's web site. (Ben Goodger is the lead engineer on the Firefox browser project.)

Also, every Firefox extension is packaged as an .xpi file (pronounced "zippy"), which is really just a .zip file. Inside the xpi, there will be a few files in addition to a .jar file. Thus, to see how any extension works, just download the xpi, unzip it, get the jar file inside of the xpi, and unjar it. This will give you all of the source code for the extension, which you can explore in order to learn how to make your own extension.

When Installing Firefox

If your extension is going to modify Firefox's UI, then make sure you do a Custom installation when installing Firefox so that you can include the Developer Tools with the list of things to be installed. This will add the DOM Inspector to Firefox's Tools menu which helps you figure out what the names of the different parts of Firefox's UI are called. To extend Firefox's UI with your own UI, you will need to know the name of the piece of the UI which you are extending, so DOM Inspector is a must for those creating Firefox extensions.

Tools

I have a list of tools that I use to create Firefox extensions on the Google Dominoes web site. I am interested in creating an Eclipse plugin that creates an empty Firefox extension as an Eclipse project because there is a bit of boilerplate code required in building a Firefox extension, and I keep screwing it up when I copy and paste it from my existing projects. Ideally, this plugin would also use Ant and Maven to package, deploy, and publish Firefox extensions.

Adding Your Extension to an Online Listing

First, you should host your extension on your own web site. Some of the online listings will host your extension for you; however, most of them would rather not. Wherever your extension is hosted, the web server that you use should send the xpi with the MIME type application/x-xpinstall. In Apache, this can be accomplished by adding the following line to the httpd.conf file:

AddType application/x-xpinstall .xpi

Before you request to be added to one of the online listings, check your extension's install.rdf file for the following:

  • Make sure that the value inside the <em:id> tag is original. If you copied your install.rdf file from an online example, or from one of your previous extensions, then this will cause a problem for users who try to download your extension in addition to the one with the same <em:id>.
  • The Mozilla Update people get upset if your <em:maxVersion> refers to a version of Firefox that does not exist. If you look at Ben Goodger's install.rdf example, you will see that he lists 1.2 as the maxVersion. Since Firefox 1.2 does not exist yet, this is a no-no. Similarly, there was a flurry of updates after Firefox 0.9 came out, so it would have been irritating to re-release your extension with every Firefox re-release just to increase your <em:maxVersion> to 0.9.1, 0.9.2, etc. Using 0.9+ is probably the most convenient for both you and for the nice people at Mozilla Update.

Once you believe that your extension is ready for primetime, you can get listed on Mozilla Update by filing the lack of publicity that your extension receives as a bug on bugzilla. If this seems odd to you, well that's good because that means you are a logical person. As explained on the Mozilla Update FAQ, they do not yet have the infrastructure to handle extension listings individually, so they are using their existing bugzilla infrastructure for the time being.

To get listed on Extension Room, you need to send an email to database@mozdev.org that includes some required information about your extension.

There is also a list of Firefox extensions at texturizer.net; however, their submission process is the same as Extension Room's, so they appear to be displaying the same database of extensions.



©2004 Michael Bolin » bolinfest@gmail.com www.bolinfest.com