Mail to the author
xavier at ultra-fluide.com

Passer au
Français

Ressources

Update of Firefox's extension.

Since Firefox 1.5, updating the browser becomes an automatic process. Nice, but... there are compatibility issues with extensions. They have their own roadmap, not necessarily coherent with Firefox evolutions.

Then, a user with a nicely personalised browser may loose, after an update, the use of his browser or some extensions:

You will find in the following a solution for the later case.

What is a Firefox extension?

Beware: this page is not a complete tutorial (see an extensive documentation [en]), but a short explanation to solve a simple problem.

A Firefox extension is a file with an .xpi suffix. This suffix is recognized by Firefox, but doesn't correspond to a new exotic file format. .xpi is just a ZIP package. Any ZIP compatible tool (try 7-zip if you don't have one) will easily open a Firefox extension.

An .xpi file contains several kinds of file (javascript, HTML, CSS, XML, jar archive...). Most of the time functional files are grouped in the chrome directory. Beside this, every extension has to contain the XML file named install.rdf that set up meta data to describe installation parameters.

Install.rdf example file

Let's see an example with the Toolbar Enhancements extension in tbx.xpi file (version 0.16.2 found on the 9th of February 2006). Once this file opened, we discover this install.rdf:

<?xml version="1.0"?>

<r:RDF xmlns:r="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
       xmlns="http://www.mozilla.org/2004/em-rdf#">

  <r:Description about="urn:mozilla:install-manifest">
    <id>tbx</id>

    <name>Toolbar Enhancements</name>
    <version>0.16.2</version>
    <description>Adds various toolbar buttons and increases toolbar
		configurability</description>

    <creator>Stephen Clavering</creator>
    <homepageURL>http://clav.mozdev.org/</homepageURL>
    <updateURL>http://clav.mozdev.org/updates.rdf</updateURL>

    <targetApplication>
      <r:Description>
        <id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</id>
        <minVersion>1.0</minVersion>
        <maxVersion>1.0</maxVersion>
      </r:Description>
    </targetApplication>

    <file>
      <r:Description about="urn:mozilla:extension:file:tbx.jar">
        <package>content/</package>
        <skin>skin/</skin>
        <locale>en/</locale>
      </r:Description>
    </file>
  </r:Description>
</r:RDF>

The <r:Description> element contains external data: name of the author, url web site, version...But we should pay attention to the <id> element that is the data used by the browser to identify the extension ( <name> is no use for this).

The <targetApplication> element gives characteristics of the target application. For example {ec8030f7-c20a-464f-9b0e-13a3a9e97384} is for Firefox. Several target applications are possible (Mozilla, Camino...). For each target application, min and max compatible versions are given (see the <minVersion> and <maxVersion> elements).

The <file> element contains information useful for extension installation.

Update an extension that can't be activate for versions compatibility reason

Every time Firefox (or other target application) has to update itself or install an extension, it compares its version with min an max versions mentioned in install.rdf file. If the conditions are true, every thing works well. On the contrary, the extension is not installed, or is deactivated.

This principle seems good in theory but depend heavily with the programmer policy in real world:

The later is more often seen, because it is not very popular for a programmer to provoke the crash of softwares. But very often too, users have to wait long for new versions of the extensions and can't use the tool while waiting.

In such a case, if there is no code incompatibility, modifying the <maxVersion> of install.rdf file is enough. In case you have several extensions deactivated after a browser update, we recommend to treat extensions one by one to be sure to detect the guilty one in case of code incompatibility. We come back to Toolbar Enhancements extension, and would like to make it compatible with Firefox 1.5.0.1 (last version on 9th of February 2006) with a new install.rdf:

<?xml version="1.0"?>

<r:RDF xmlns:r="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
       xmlns="http://www.mozilla.org/2004/em-rdf#">

  <r:Description about="urn:mozilla:install-manifest">
    <id>tbx@clav.mozdev.org</id>

    <name>Toolbar Enhancements</name>
    <version>0.16.2</version>
    <description>Adds various toolbar buttons and increases toolbar
		configurability</description>

    <creator>Stephen Clavering</creator>
    <homepageURL>http://clav.mozdev.org/</homepageURL>
    <updateURL>http://clav.mozdev.org/updates.rdf</updateURL>

    <targetApplication>
      <r:Description>
        <id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</id>
        <minVersion>1.0</minVersion>
        <maxVersion>1.5.0.*</maxVersion>
      </r:Description>
    </targetApplication>

    <file>
      <r:Description about="urn:mozilla:extension:file:tbx.jar">
        <package>content/</package>
        <skin>skin/</skin>
        <locale>en/</locale>
      </r:Description>
    </file>
  </r:Description>
</r:RDF>

We use the wildcards (*). Then the extension becomes compatible this all minor versions of Firefox 1.5.0. We also did modify <id> of the extension as its syntax was not compatible with 1.5 version of Firefox. Then it is enough to put back this install.rdf in the tbx.xpi file and get a perfect compatible extension with Firefox 1.5.0.1.

These are the corresponding downloads for the 5 extensions that we had to modify (updated for Firefox 7 except Toolbar Enhancements, Tab X and ResizeSearchBox ):


Agence de communication Ultra-Fluide : 01 47 70 23 32 - contact at ultra-fluide.com - 44 rue Richer 75009 Paris.