47

Previously, I could write an addon for personal usage packed as something.xpi and I clicked on it to install it.

After a while, mozilla introduced xpinstall.signatures.required which you could still get around it.

However, it did not stop stabbing developers who are interested to have a personal addon isolated from the world. Today, only web extensions are working and my XUL based addon is thrown away. The tutorials only talk about temporary installation of a web extension while I want my one runs on firefox forever.

Beside whether I can use web extension to write into files or create a GUI in an independent page, I have a bigger challenge:

How can I install a local web extension permanently without creating a Mozilla account for personal usage?

ar2015
  • 5,558
  • 8
  • 53
  • 110
  • @sachinjain024, the problem is with step 2. What if you like to isolate yourself from a central involvement? – ar2015 Nov 24 '17 at 04:29
  • It is just having an Mozilla account and it is just used for signing the addon. They won't review the code and host it but they still validate if things are fine like manifest is valid etc. This is the least involvement in self hosting addon. – Sachin Jain Nov 24 '17 at 10:10
  • 1
    The blog post linked above is now under a new URL - https://www.requestly.in/blog/2018/06/16/self-host-mozilla-add-on/ – edison23 Aug 19 '20 at 10:35
  • 1
    See also a linked question: [Install a custom firefox web extension permanently - without mozilla account OR unstable vers of Firefox - Stack Overflow](https://stackoverflow.com/questions/54272920/install-a-custom-firefox-web-extension-permanently-without-mozilla-account-or?noredirect=1&lq=1) – user202729 Sep 26 '21 at 01:52
  • 1
    Also: you can open the browser console (not developer console!) by pressing ctrl+shift+j (there's a GUI button in Firefox developer edition), there should be more info of the error there. – user202729 Sep 26 '21 at 02:58

6 Answers6

14

Navigate to the folder where your extension is located. You can build it in the usual way using web-ext:

web-ext build

You can install this ZIP file permanently in Firefox by going to about:addons and dragging this file into the tab.

In order for this to work, you need to set xpinstall.signatures.required to false in about:config (works only for Nightly and maybe Developer Edition).

snnsnn
  • 10,486
  • 4
  • 39
  • 44
Smile4ever
  • 3,491
  • 2
  • 26
  • 34
  • 4
    In a new version you also need an ID in the manifest.json file, see [another answer](https://stackoverflow.com/a/67501680/5267751). – user202729 Sep 26 '21 at 01:50
  • 1
    "The generated .zip file doesn't work on Firefox without signing or adding browser_specific_settings.gecko.id key into manifest.json. For more information, please refer to the WebExtensions and the Add-on ID page." You need to add `browser_specific_settings` , see [this page](https://extensionworkshop.com/documentation/develop/getting-started-with-web-ext/) – craymichael Nov 08 '21 at 00:41
9

Apart from setting xpinstall.signatures.required to false, you need to add this to your manifest.json:

  "browser_specific_settings": {
    "gecko": {
      "id": "some-name@example.org"
    }
  }

Found on https://www.reddit.com/r/firefox/comments/blqffs/how_to_permanently_add_temporary_addon/exh2u3o/, thanks to "alexherbo2".

Ida
  • 3,994
  • 21
  • 40
5

You need a "blueish" Firefox -- Developer Edition (effectively beta) or Nightly (unstable, updated every night).

You can get them from https://mozilla.org/firefox/channel/desktop/.

Then xpinstall.signatures.required will work again.

(As for permissions--you can create a GUI in a tab or a popup, but I don't think you can do it in a separate window (unless you do a webpage-style popup window). You won't be able to write to arbitrary files anywhere on the system--which is a good thing! You can write to the Downloads folder, and read/write some sort of internal storage, but that may not expose the actual files involved. For more information see https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Working_with_files.)

SilverWolf
  • 284
  • 2
  • 13
2

What you should be looking for is having your extension signed by Mozilla as Unlisted.

See Mixing Listed and Unlisted Add-ons on addons.mozilla.org blog post for an overview.

That way, AMO does not host nor (normally) review your extension; it simply runs some basic automated checks and immediately signs your extension so that it can be privately distributed as an XPI.

Xan
  • 74,770
  • 16
  • 179
  • 206
2

For those interested in developing/running an extension from a local directory without having to package or load it manually via "Load Temporary Addon..." from about:debuggin#/runtime/this-firefox please go to this github repository.

From the README.md:

The procedure involves a few steps, but it needs to be done only once.

First you need to enable AutoConfig aka userchrome.js by copying the file config-prefs.js to [Your Firefox install directory]/defaults/pref

Note: For best security, on Windows it is best to leave your Firefox install in "c:\Program Files" so that your config-prefs.js and userChrome.js can only be modified when you are in root/admin mode.

Then you need to edit the file userChrome.js and modify the function installUnpackedExtensions() to reflect the locations of your own addons.

The modified userChrome.js then must be copied to your Firefox installation directory. For example on Windows this is usually "c:\Program Files (x86)\Mozilla Firefox" for the 32-bit version of Firefox. You can rename the file, but remember to modify the corresponding line pref("general.config.filename", "userChrome.js") in defaults/pref/config-prefs.js

Now your addons from your local directories will be loaded automaticaly whenever Firefox starts. After editing your code remember to reload it from about:debuggin. You can also get there via the menu by selecting "More Tools", then "Remote Debugging", and click on "This Firefox" on the left side (but the quickiest way is to bookmark it and then add a bookmark keyword such as "dbg" for quick access.)

Please note that this is an automated install of the extension every time Firefox starts, so it is not quite the same as a "permenent install". That is, this procedure has exactly the same effect as clicking on "Load Temporary Addon..." from the about:debuggin page, just that the process is now automated via userChrome.js. This means that if you have code that does something after the installation of the extension such as browser.runtime.onInstalled.addListener(details => { if (details.reason == "install") { ...do something after install... }); then this code will be called every time Firefox is launched.

tst
  • 479
  • 4
  • 7
  • Thanks! This is working for me in the latest build (112.0.2) on macOS. I just put the files off of the `/Firefox.app/Contents/Resources/` directory. – Matthew S Apr 25 '23 at 22:20
  • For my case(macOS, venture 13) worked when I put `config-prefs.js` into `app-dir/Firefox/Contents/Resources/defaults/pref/` and `userChrome.js` into `app-dir/Firefox/Contents/Resources` – e.saleh Aug 02 '23 at 06:38
-1

You can try setting the preference extensions.legacy.enabled (this will only work in Nightly or Dev Edition).

Andrew Swan
  • 1,268
  • 6
  • 7
  • for me it is equal to `true`. But not all legacy addons can be enabled. My addon cannot be enabled too. Only, adblock can be enabled. – ar2015 Nov 20 '17 at 06:06