Home | Blog | Previous LegacyFox

Coaxing modern Firefox into running legacy Extensions

This is a bonus to the LegacyFox blog post—read that one first.

The stubborn way

If for some reason (like wanting to use your distribution's prepackaged Firefox) this won't cut it for you, there is a more elaborate and less reliable way. This method also worked with regular (non-ESR) versions of Firefox up to v64[1], but using such an outdated browser is not recommended. In June 2019, two high-risk security vulnerabilities have been disclosed, so yeah.

First off: This is a stupid idea. Mozilla prevents you from doing this for good reasons. But here we go:
Let's start off by setting some values in about:config. There is a file that we can use to automatically set them for us. It is located in Firefox's profile directory, which is usually in ~/.mozilla/firefox/, followed by a random string of characters. If you've got more than one, have a look at profiles.ini; one should have Default=1 set.

user_pref("extensions.legacy.enabled", true);
user_pref("xpinstall.signatures.required", false);
user_pref("app.update.enabled", false);  // would override our patched omni.ja

Then we need to patch omni.ja[2], a zip archive that contains much of Firefox' runtime Javascript. In it, there are a bunch of configuration options, including the flag that checks, if you're allowed to enable legacy extensions.

#!/bin/sh -ex
FIREFOXDIR=/usr/lib64/firefox/  # must be absolute!

rm -rf "$TEMP_OMNI"
mkdir "$TEMP_OMNI"

# unzip will complain about the archive, so ignore exit code
unzip -q "$FIREFOXDIR/omni.ja" ||:

# ALLOW_LEGACY's values is two lines below; hence 'n;n'
sed -i '/MOZ_ALLOW_LEGACY_EXTENSIONS/{n;n;s/false/true/}' \

zip -qr9XD "$TEMP_OMNI.ja" -- *

sudo cp "$FIREFOXDIR/omni.ja" "$FIREFOXDIR/omni.ja.bak"
sudo mv "$TEMP_OMNI.ja" "$FIREFOXDIR/omni.ja"

You'll have to run this script after every Firefox update, preferrably automatically. Make sure, the path in FIREFOXDIR is correct for your distribution. A big shout-out to Akkana Peck, on whose code this is based on.

This will let your old add-ons run again, but chances are, they rely on some of Gecko's APIs, which may have been removed and some changes to them might be required. Mozilla won't sign legacy extensions for you any more, so you'll need to persuade Firefox somehow. So we need to disable Add-on signing. This comes courtesy of a user on "Hacker" "News"[4]. I'm too lazy to incorporate this into the above script (patches welcome!), and I'm not sure if you'll need all those scripts to do it, but it works for me™. Depending on your distro, the paths may vary slightly.

// keep this comment
try {
    .import('resource://gre/modules/addons/XPIDatabase.jsm', {})
} catch (ex) {
pref("general.config.obscure_value", 0);
pref("general.config.filename", "config.js");
pref("general.config.sandbox_enabled", false);


I hate footnotes. But I won't bore/distract/confuse you with my (attempt at) snarky humour, unless you really want me to. Press your user agent's hotkey for window.history.back() to get back to where you were coming from.