-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto grant extension perms when invoking "web-ext run"? #2927
Comments
I thought about this problem a bit more today and it seems like if I could track down where the extension permission state lives, which I guess should be in the profile (?), maybe I could invoke After digging around the web-ext repo a bit I found this. pref: {
describe:
'Launch firefox with a custom preference ' +
'(example: --pref=general.useragent.locale=fr-FR). ' +
'You can repeat this option to set more than one ' +
'preference.',
demandOption: false,
requiresArg: true,
type: 'array',
coerce: (arg) =>
arg != null ? coerceCLICustomPreference(arg) : undefined,
}, and 'firefox-profile': {
alias: 'p',
describe:
'Run Firefox using a copy of this profile. The profile ' +
'can be specified as a directory or a name, such as one ' +
'you would see in the Profile Manager. If not specified, ' +
'a new temporary profile will be created.',
demandOption: false,
type: 'string',
}, Now I'm trying to figure out if web-ext run --firefox-profile=/Users/paws/Developer/firefox-profile-webextension-dev --keep-profile-changes
Running web extension from /Users/paws/Developer/webextensions-examples/borderify
Use --verbose or --devtools to see logging
Installed /Users/paws/Developer/webextensions-examples/borderify as a temporary add-on
The extension will reload if any source file changes
Press R to reload (and Ctrl-C to quit) Seeing "temporary add-on" makes me think I will need to assign a stable ID in manifest.json. |
Success! 🥳 This approach I landed on still requires a manual GUI step, but it's only once instead of N times.
...
"browser_specific_settings": {
"gecko": {
"id": "[email protected]",
}
},
...
NB, I'm not 100% sure but you may need to first invoke A cooler approach would be avoiding the GUI step comletely, e.g. `web-ext --allow-all-extensions" but this is good enough for today. Hope this helps someone else dipping their toes into the WebExtension v3 world. |
You saved me hours of my time, thank you very much! At first I couldn't work out why my content script wasn't loading, until I realised that it required permissions. Then the question was how to keep those permissions enabled permanently, which you have answered above. I suggest reopening this as it is likely we are not the only ones having this problem, and in my view this is unexpected behavior - |
To improve the developer experience, I created a ticket to add a helpful message when a MV3 extension is loaded: #2980 The request also includes a full description on implementing it, and patches are welcome! |
Glad to hear it helped you @rnwst! Definitely had to jump through hoops to figure this out 😅 Caveat, I haven't tried it personally, but after making this issue, I read up on Firefox Developer Edition and learned it apparently relaxes certain extension perms already. Not sure if it additionally addresses this particular friction, which presumably most MV3 extension developers will face. Would be nice! :) |
The deved exceptions above do not help with working around this issue. All it does is allowing unsigned extensions to be used AND temporarily loaded extensions to use privileged code. Do not use these to install untrusted extensions, because they put your whole system (outside of Firefox) at risk. |
Thanks, helpful info! Your comment made me curious if extensions can shell out similar to other commands like xp_cmdshell. I found a current Chrome doc that describes Native Messaging, but a search also revealed there is (or used to be? I didn't try it) |
Is this a feature request or a bug?
Feature request (I think).
If this already exists, apologies, feel free to close.
What is the current behavior?
web-ext run
with a permissionless v3 extension, e.g. thisWhat is the expected or desired behavior?
When developing an extension, it's annoying to have manual steps in the feedback loop like this. It would be nice to have that permission automatically enabled, especially given it's an ephemeral dev browser instance anyway.
Possible?
i.e. like this
Alternatively, if this is not in scope for
web-ext
, is there some way to set state in e.g. the Firefox profile?(obviously it should persist across runs -- I noticed the extensions perms seem to reset every time. Just guessing but I wonder if the profile, which I'm assuming is where these user-entered perms get persisted, can be manually specified ahead of time.)
Version information (for bug reports)
The text was updated successfully, but these errors were encountered: