Persistent Loaded Dev WebExtension - Possible?


(Matt) #1

As I work on my extension, I want to have it continually loaded as I browse the web in my daily use. I don’t want to start up a separate instance using something like “web-ext run” specifically to test functionality in a dedicated session.

Is this possible? Can I load a local dev version of my extension and have it persist across my normal browser tabs, and between sessions? If not, I would really appreciate this feature.

Until now, I have been building and using a Greasemonkey version of my extension code. It got rebuilt and installed whenever I changed code, and was instantly reloaded during normal browser use.

Now, Greasemonkey is broken in Firefox 57. And even when (if) it works again, it won’t have access to the filesystem (thanks, WebExtensions…), so I can’t just update the local js file and F5 my page. I’ll need to manually copy/paste the source into a new GM interface. Not horrible, but significantly more annoying.


(Niklas Gollenstede) #2

changed to content scripts are applied as soon as you reload the tab.

Or you upload it to AMO as unlisted.


(Matt) #3

Unfortunately this is a manual process, which I need to do every time I start Firefox. I am looking for something more persistent.


(Niklas Gollenstede) #4

True. So:

you upload it to AMO as unlisted

and install the immediately automatically signed extension permanently.


(Matt) #5

Then every time I update my code, don’t I need to re-upload the code and re-install the extension? Maybe I’m misunderstanding that part?


(Niklas Gollenstede) #6

Yes.

Maybe I’m misunderstanding that part?

Nope. But there are only three options. The tow I mentioned before, which both lack in a way, and using chrome instead of Firefox, which lacks in other ways.


(Matt) #7

This is unfortunate. Chrome also has the annoyance of having to ‘reload’ developer extensions after each change, but at least they stay installed between sessions.

I guess, for now, using about:debugging is the best way. I hope they consider this going forward, and allow developers to install development versions of extensions that persist across sessions, and ideally even reload themselves when changes are made.


(Andrei Petcu) #8

npm i -g web-ext

cd mywebext

web-ext run


(erosman) #9

I do the same. I develop, work and road test on addons while they are installed

  • In order to use unsigned extension you must use one of the versions that allows it (e.g. Nightly, Dev, Unbranded)

  • Next go to Firefox extensions folder. In Windows it is here:

    C:\Users\****\AppData\Roaming\Mozilla\Firefox\Profiles\****.default\extensions

  • Create a text file in that folder and name it the ID of the extension (without any file extension) e.g. myExt@something or whatever it is. WebEXtension MUST have as ID for this to work.
    https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/applications

  • Inside the text file, paste the location of the addon on your hard disk
    e.g. C:\Users\****\Documents\myExt

  • Restart the Firefox and it asks you if you want to install and enable the addon

  • You can work on the code with your normal editor

  • Prior to FF55, disabling & enabling the addon would refresh the code and apply the changes. From FF5 recursive directory scan, at startup has been removed. In order to affect the new changes to the background/content code, you can use the Load temporary Add-on from about:debugging to reload the same installed addon and the data gets overwritten.
    ref: https://bugzilla.mozilla.org/show_bug.cgi?id=1382762

  • There is no need to reload the addon for changes to the option pages, sidebar or popups. Changes to those are applied immediately since they are loaded fresh each time.

I hope that helps.


(Matt) #10

Before I give this a try, does it work between sessions? That is, if I quit Firefox and open it again, it will still be installed?

I’m using the beta channel, so I’m on FF57. Will that work?


(erosman) #11

I have been doing it this way for 8+ years and I am also currently on FF57.0a1

It is installed normally like any other installed add-on.
I stays on normally like any other installed add-on.

The system of using Load temporary Add-on from about:debugging to reload the background script has some issues like if there are errors in the code and not corrected before shutting the browser then on occasion add-on disappears and you have to do it again, but nonetheless, that is the ONLY way to keep under-development add-ons installed permanently.


(Matt) #12

Unfortunately this didn’t work for me (FF57.0b5, Windows). I did exactly as you describe but Firefox never prompted me to install the extension.


(erosman) #13

I have 15 add-ons loaded that way. If done correctly, on FF57 (I am using FF57.0a1 Windows) there will be an exclamation on the hamburger menu and if you click on it you will see the notice.


(Matt) #14

Is there documentation for this approach somewhere? I’ve done it exactly as you describe and I still don’t see any exclamation point on the hamburger menu, and my extension doesn’t appear anywhere.

I’ve created a file in my extensions folder with the exact name of my Web Extension’s id, and pointed the path. No luck. If I install the same directory as a temporary extension, it works.


(Matt) #15

I did find that I had xpinstall.signatures.required set to true. Changing it to false and restarting Firefox made no difference. :frowning:


(erosman) #16

There must be… I have been doing it this way for years :stuck_out_tongue: … and I did read it somewhere… let me see if I can find it

You must be using Nightly, Dev or Unbranded… release version dont allow unsigned extensions and “xpinstall.signatures.required” was for older Firefox.

But to help you…

What is the extension ID and what is the location of it folder on your hard disk?

Here also describes a similar method: https://robertnyman.com/2009/01/24/how-to-develop-a-firefox-extension/

Read the section: Point your Firefox extensions directory to your extension


(Matt) #17

Okay, got it. Sorry for taking so much of your time, but thank you!

Turns out, I’m on FF57 but it’s the beta channel, not dev channel. I thought beta==dev, since they are both 57. My mistake. Once I switched to Dev, this method worked fine and my browser is now recognizing the extension.

Thank you again, and I hope this thread will be helpful to others in the future!