How To Future-Proof Your Firefox Extensions

Sep 28, 2005 (01:09 PM EDT)

Read the Original Article at

I'm a big fan of Firefox extensions, and it shows: I have 40 extensions installed on one of my PCs, and on the others -- including Windows 2000, Linux, and Mac OS X systems -- I rarely run Firefox without at least 20 of my favorites installed, sometimes together, other times spread across two or three different profiles.

Like many Firefox power uses, I also installed the Firefox 1.5 beta not long after Mozilla released it. And when I ran the beta for the first time, I discovered that just 10 of those 40 extensions ran, too. Firefox 1.5 found the rest "incompatible" when it started for the first time and disabled them.

Some of you already know what I'm going to tell the rest of you: Most of those disabled extensions are no less compatible with Firefox 1.5 than they are with Firefox 1.0.7 (or Firefox 1.0.6, as it was at the time I installed the 1.5 beta). The only show-stopper in these cases is a single piece of metadata that allows an extension to work only with a specific et of Firefox versions: On the site, you'll see this information listed with each extension (e.g., "Requires: Firefox: 0.9.x - 1.5beta").

These numbers reflect the value of minVersion and maxVersion in each extension's resource.rdf file. Firefox checks these values against one of its own config-file settings ( app.extensions.version); when a user installs a new version of Firefox and starts it for the first time, the browser disables extensions for which the version info doesn't add up correctly.

If you create an extension hosted on your own site or some other third-party site, then of course you're free to disable maxVersion by setting it to a very high number. If you want Mozilla to list your extension, however, then you have to include a value for maxVersion, and typically you may not list a version number that's much higher than the current public release -- in this case, Firefox 1.5.

Instant Fiasco: Just Add Users
There's a lot that's new about Firefox 1.5. Some extensions really are broken and require serious retooling -- and a few of those, if you happen to run them anyway, just might turn your Firefox profile into something that looks like Beetle Bailey after Sarge beats him to a pulp. But the others -- probably a solid majority of the 600-plus extensions currently listed with -- will either work as-is or require minor tweaks.

Why would Mozilla deliberately cripple hundreds of extensions that otherwise work just fine? Because it beats the pants off "Plan B": a world full of abandoned or broken extensions, at least some of them capble of doing Bad Things to unsuspecting users' Firefox profiles.

In this situtation, most Firefox users won't say to themselves: "Darn! That old, abandoned extension just slagged my profile -- it's a good thing I always back up my important data files!" They will say: "My stuff! Where's my stuff! Who broke my browser? What happened?" Multiply this reaction enough times, and you've got the makings of a bona fide PR fiasco.

Mozilla's maxVersion requirement helps to manage this risk by constantly weeding out abandoned extensions (at least those in the "official" Mozilla catalog; those hosted elsewhere can do as they please, of course). Adjusting the version info is about as easy a job for a developer as it gets, but it at least requires them to show up occasionally, kick the tires on their extension, take it for a quick test drive, and show the world they still care. Also, since they have plenty of time to do this during the beta cycle (at least in theory), by the time Firefox 1.5 goes legit later this fall, almost all of the extensions that will ever get the fix have already gotten it.

Not everyone likes the way this system currently works: includes at least four proposals to change or drop the maxVersion requirement. Judging from the lively and at times heated exchanges in some of these discussions, the issue isn't likely to go away, either.

For Firefox lead Ben Goodger and his colleagues, however, the benefits of enforcing maxVersion continue to outweigh the costs -- not to developers and power users, but to the other 98 percent of the Firefox user base. (As more extensions become indispensaible to large numbers of users, I wonder whether this will always be true: When a wildly popular extension such as Adblock breaks, the number of irate users makes it as much Mozilla's problem as the developers'. But that's a topic for another day.)

Now that I've explained why maxVersion is a good idea, I'll tell you something else every Firefox power user should know: How to turn it off.

Revive Those XPIs
The beauty of Firefox, of course, is more than just skin deep: Power users can and do tweak the product in an infinite number of ways. If you're willing to overrule Mozilla's play-it-safe default extension settings, chances are you can get most of your disabled extensions working in a matter of minutes. In fact, there are several ways to do this, depending on how many extensions are involved and how you want to use them.

A word of warning: I'm about to discuss hacks that could break your extensions, trash your Firefox profile, get you fired, and for all I know, turn you into a Cocker Spaniel. Back up your Firefox profile, and maybe put down some newspapers on the floor, before you try any of them. If you don't back up your profile and Something Really Bad happens, then you've just learned a valuable lesson -- so quit whining.

Also, before you hack, get the facts. (No, not that ""Get the Facts.") Firefox lead developer Ben Goodger has published a tutorial on ""Extension Versioning, Update and Compatibility," which is about as good an overview on the subject as you'll ever get. Learn how and why the system works, and then you can break it with a sense of panache.

Method One: Single-Hack
Goodger also spells out the first and easiest way to install extensions with incompatible maxVersion values: Temporarily change the value of app.extension.version in Firefox, using the about:config interface. As Goodger notes, you should always reset the true value when you're done installing; doing so won't reverse your changes (Firefox only checks once and then leaves the extension in peace), and it might prevent a version-control train wreck in the future

While this is the easiest way to activate extensions as you install them for the first time, it won't reactivate your current extensions after an updated version of Firefox has already deactivated them. To deal with those, try Method Two (for individual extensions) or Method Three (for the whole bunch) below.

Also: After you've made a mess of things (which is the only way to learn anything useful, right?), Goodger includes instructions on how to start Firefox in Safe Mode on each supported platform, so that you can yank out a rogue extension even if it's running amok on your system. Sometimes, Safe Mode will save your bacon, and sometimes it won't -- so always back up your profile or be prepared to start over with a new one.

Method Two: Hack-N-Share
If you're like me, people may assume that you know something about computers, just because you spend so much time talking to them. Don't disappoint: If you modify maxVersion in the extension itself, you can share the .xpi file with your friends and amaze them with your godlike mastery of Firefox's mysteries.

(You could also use their PCs as guinea pigs to test extensions that may or may not lobotomize your profile when tampered with in this manner. That's entirely up to you, and I did not just suggest this.)

Either way, you start with the extension's .xpi file: basically a fancy-pants .zip file, which you can open using the same kinds of tools. Extract the resource.rdf file, and then with a text editor such as Notepad (do NOT use Word, Wordpad, etc. for this job), change the value between <em:maxVersion> and </em:maxVersion> so that it's equal to or greater than your Firefox version number.

How high should you make this value? Anything between 1.5 and 999 will work; while using the latter number may be mildly amusing, using the former will prevent your distant descendants from wondering what on earth "Blinky" is and why it just crashed their brand new hyperspace quantum computer running Mac OS XC.

Method Three: Mass-Hack
Finally, there's a workaround that will get all of your previously installed, disabled extensions working within minutes, at the push of a button. If you've got, say, 30 disabled extensions to revive, you're inherently lazy, you've come to the right place.

Actually, this isn't even a proper workaround; instead, you'll rely on yet another extension, Nightly Tester Tools, to do the dirty work for you. In this case, I used version 0.7.7 of Nightly Tester Tools, available at The Extensions Mirror, a site that anyone who enjoys coloring outside of the lines with Firefox should check out. I discovered this maxVersion hack, as well as the links to Bugzilla entries I mentioned before, courtesy of an Extensions Mirror forums tutorial on the topic.

(Note: Although the version hosted at the last time I checked was an older build (0.6.5), I believe it, too, now works with Firefox 1.5.)

Once you install Nightly Tester Tools, re-open your extensions manager, right-click on each disabled extension, and choose the "make compatible" option. You can reactivate multiple extensions with a single restart, although you'll obviously have a much harder time identifying the culprit if something goes wrong. I re-activated my extensions one at a time and quickly checked them before moving on; when one didn't work properly, I pulled it back out immediately.

So, how many of my 30 comatose extensions did I revive? The numbers were encouraging: 27 of them passed first muster, which in this case meant that I could view an extension's options and that menu bars or context menu items appeared where they should have. Also, when I actually spent time working with each extension, several that looked OK at first turned out to be unstable -- they got the "Ol' Yeller treatment" a day or two later.

In the end, I got at least 20 of those 30 extensions to work (a couple are still in the "maybe" category), without mangling either Firefox 1.5 or my profile. Under the circumstances, I'd say that's a good day's work for any hard-core Firefox extensions fan.

Matt McKenzie is the editor of Linux Pipeline. He's still waiting for Archie and Gopher to make their big comebacks.