ar2015
ar2015

Reputation: 6150

Install a personal firefox web extension permanently

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?

Upvotes: 59

Views: 30697

Answers (6)

Smile4ever
Smile4ever

Reputation: 3704

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

Upvotes: 15

tst
tst

Reputation: 667

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.

Upvotes: 3

Ida
Ida

Reputation: 3965

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

Upvotes: 12

SilverWolf
SilverWolf

Reputation: 304

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

Upvotes: 7

Xan
Xan

Reputation: 77591

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.

Upvotes: 2

Andrew Swan
Andrew Swan

Reputation: 1343

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

Upvotes: -1

Related Questions