Install a personal firefox web extension permanently
Asked Answered
A

6

58

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?

Allocation answered 18/11, 2017 at 7:1 Comment(5)
@sachinjain024, the problem is with step 2. What if you like to isolate yourself from a central involvement?Allocation
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.Eterne
The blog post linked above is now under a new URL - requestly.in/blog/2018/06/16/self-host-mozilla-add-onDiastrophism
See also a linked question: Install a custom firefox web extension permanently - without mozilla account OR unstable vers of Firefox - Stack OverflowTog
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.Tog
W
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).

Watereddown answered 23/11, 2017 at 8:24 Comment(2)
In a new version you also need an ID in the manifest.json file, see another answer.Tog
"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 pageAnglicize
L
10

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

  "browser_specific_settings": {
    "gecko": {
      "id": "[email protected]"
    }
  }

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

Lotion answered 12/5, 2021 at 10:18 Comment(0)
B
7

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.)

Brocket answered 25/2, 2018 at 0:9 Comment(1)
Maybe I shift to server-client using node.js as a quick working solution.Allocation
R
3

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.

Rollins answered 20/9, 2022 at 3:8 Comment(2)
Thanks! This is working for me in the latest build (112.0.2) on macOS. I just put the files off of the <Application Dir>/Firefox.app/Contents/Resources/ directory.Wiredraw
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/ResourcesLeaden
G
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.

Geryon answered 23/11, 2017 at 16:9 Comment(0)
T
-1

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

Thornburg answered 20/11, 2017 at 5:41 Comment(1)
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.Allocation

© 2022 - 2024 — McMap. All rights reserved.