Skip to content

Instantly share code, notes, and snippets.

@madushan1000
Created September 27, 2020 00:00
Show Gist options
  • Save madushan1000/37269559cbf19cb03f0171d81e10ffea to your computer and use it in GitHub Desktop.
Save madushan1000/37269559cbf19cb03f0171d81e10ffea to your computer and use it in GitHub Desktop.
Run legacy/privileged extensions in stable/beta firefox
  1. Enable the browser console (about:config -> devtools.chrome.enabled=true) and open it.
  2. Copy the following code change the to your xpi file path and insert it into the browser console.
Cu.import('resource://gre/modules/addons/XPIInstall.jsm')
Cu.import('resource://gre/modules/addons/XPIProvider.jsm')
Cu.import('resource://gre/modules/addons/XPIDatabase.jsm')

var nsIFile = Components.Constructor( "@mozilla.org/file/local;1", "nsIFile", "initWithPath" );
var xpiFile = new nsIFile('<full path to xpi>');

var addon = await XPIInstall.loadManifestFromFile(xpiFile, XPIInternal.XPIStates.getLocation('app-profile'));
addon.signedState = 4;
addon.appDisabled = false;
XPIInstall._activateAddon(addon)
  1. Addon will have access to all the legacy APIs and browser internals.
  2. This doesn't preserve the addon after restart, there might be a way to do it, needs more research.
  3. I was annoyed that Mozilla decided not to let users choose to run webextension experiments in stable/beta version of the browser even as a temporary extension.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment