Updating Firefox extensions to work with Firefox 3

As Firefox moves towards version 3, you may want to test the new software for yourself… only to find that your favourite extensions do not install, and have not yet been updated by the developers. The Selenium IDE installer, for example, has been constructed to install on versions of Firefox from 2.x to 3.0b3 only. If you try to install it you get the following error:
Should you wish to use the latest beta of Firefox 3.0 for testing, you will need to modify the Selenium installer. In order to accomplish this, you need to download and modify it. The following instructions will also apply to most other extensions.

  • Download the .xpi

Go to Selenium and right-click on the download link, selecting ‘Save Link As’
If you don’t do this, Firefox will always try to install the extension.

  • Rename it to .zip
  • Open the zip file and edit the install.rdf file
<?xml version="1.0"?>
<RDF:RDF xmlns:em="http://www.mozilla.org/2004/em-rdf#"
         xmlns:NC="http://home.netscape.com/NC-rdf#"
         xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <RDF:Description RDF:about="urn:mozilla:install-manifest"
                   em:name="Selenium IDE"
                   em:id="{a6fd85ed-e919-4a43-a5af-8da18bda539f}"
                   em:version="1.0b1"
                   em:description="Record, edit and play Selenium tests"
                   em:creator="Shinya Kasatani"
                   em:homepageURL="http://www.openqa.org/selenium-ide/"
                   em:optionsURL="chrome://selenium-ide/content/optionsDialog.xul">
    <em:targetApplication RDF:resource="rdf:#$8MZop3"/>
  </RDF:Description>
  <RDF:Description RDF:about="rdf:#$8MZop3"
                   em:id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
                   em:minVersion="1.5"
                   em:maxVersion="3.0b3" />
</RDF:RDF>

You need to change the em:maxVersion value. If you change it to 3.0b5, for example, it will work with the current beta. If, however, you change to to 3.*, it will work with any 3.xrelease of Firefox.

  • Save the edited install.rdf back to the zip

You have to put the install.rdf file back in the same place in the zip/xpi file; in this instance it is easy, as the rdf file is in the root of the file tree. Sometimes, however, the files are in subtrees and this structure must be maintained. The easiest way is to open WinZip and edit the file from within WinZip. This way when you save the file WinZip will prompt you to update the archive with the changes automatically. Rename the .zip back to .xpi

  • Open Firefox 3.0
  • Drag and drop the .xpi file on to Firefox

When I said ‘most extensions’ earlier, there are exceptions. In some xpi files there is a meta-inf directory, containing a manifest.mf file, which looks like this:

Manifest-Version: 1.0
Created-By: Signtool (signtool 3.10)
Comments: PLEASE DO NOT EDIT THIS FILE. YOU WILL BREAK IT.

Name: chrome.manifest
Digest-Algorithms: MD5 SHA1
MD5-Digest: Qrb3md3Ag/oArwtPTDbU/w==
SHA1-Digest: lkn8o3DYwmUJQFtGl9Ge4IamdI4=

Name: install.rdf
Digest-Algorithms: MD5 SHA1
MD5-Digest: qVGIJ3lmKZw67cudUlcaKw==
SHA1-Digest: KR/ASWZDbj6kN/Iqj0mc45gdE4U=

Name: chrome/chromeFiles/content/browser-overlay.css
Digest-Algorithms: MD5 SHA1
MD5-Digest: wpNjQ1IFLOcH6eSe1XZM9A==
SHA1-Digest: c6grl9KPrlXgMsY3Ls+/Rl8abBs=

...

As you can see, there’s an MD5 and an SHA1 signature for each of the files, including the install.rdf. So if you change the install.rdf file, you will break the MD5- and SHA1-Digest for it, getting the following error when you try to install:
The easiest way to deal with this is to delete the entire meta-inf directory from the xpi/zip (this will work with, for example, the Google Firefox extensions).

It's only fair to share...
Share on FacebookGoogle+Tweet about this on TwitterShare on LinkedIn

Leave a Reply