web-ext
web-ext copied to clipboard
Allow connecting to already running Firefox when using web-ext run
It would be great if we could use web-ext to install an add-on in an already running Firefox. This is especially useful if you are developing an add-on for a page that requires a log-in. I know I can quit Firefox and web-ext run using the existing profile, or I can just log in on the newly created profile, but it would be more convenient if I can just have it connect to my current Firefox instance.
This is similar to the approach we take in the Android patch (https://github.com/mozilla/web-ext/pull/868). However, I don't think what you're proposing will be possible because web-ext needs to make modifications to the profile in order to function correctly. Thus, web-ext pretty much always needs to alter the profile before Firefox starts.
Thanks for taking the time to file an issue!
I actually have a working patch for this, it just needs polish and some design decisions. All the developer really needs to do afaik is open gcli and enter e.g. listen 6060, which can easily be documented. I am not sure the other preferences are really needed to function, can you point out which those would be?
Yeah, I think all web-ext needs is access to the debugger. It seems like this will confuse users who are less experienced and who don't read docs but I suppose if you have a patch then we can consider it. I will admit that other people have asked for it but mostly it was because they didn't know about other ways to do it.
it would be more convenient if I can just have it connect to my current Firefox instance
Why? The case you described sounds like it would be really convenient as web-ext run --firefox-profile default (if default was the profile name). You wouldn't have to quit your running Firefox. This command would copy your profile into a temporary profile and would allow you not to pollute that profile.
That is indeed handy, but my profile is 1GB large, and I don't want to copy that around each time I test an add-on.
If you don't believe this feature is useful I don't have any bad feelings if you want to close this. I am fine just keeping the WiP patch applied locally and will use it for myself.
Wow, 1GB? Is the --firefox-profile option noticeably slow?
Not major, likely due to the SSD. I can make way with this as well, I don't debug add-ons often enough that this would really be a problem for me, but copying the whole profile just for a debugging session where I can instead use the browser I have running sounds like a workaround to me.
Would also be splendid if web-ext rolled back the modifications to the profile that it makes—if they aren't really so bad as to botch the profile for regular use, as the docs suggest. Then, in combination with this very feature, testing an extension with live-reload would become more frictionless.
(However, there's a detail that web-ext should do the rollback also in cases of exiting with an error, not only in successful operation.)
I guess this is a separate issue/request, of course.
This is especially needed now that it's no longer possible to install an extension sourced from a local path (it has to be bundled into an XPI first). That means even if you use the double-load as a temporary extension workaround to get code reloading, on browser restart it gets sourced from the out of date XPI.