-
Notifications
You must be signed in to change notification settings - Fork 2
Events are only listened in the same context that requested them #1
Comments
Hey, I'm interested in this use case! Does #4 support the any context case or is it still a work in progress? Thanks for creating this polyfill. |
It should support any context that supports |
Sure thing! I'll give it a go and let you know how it works out. |
Ah yes you'd have to build it first, you can install directly. Probably something like: git clone https://github.com/fregante/webext-permissions-events-polyfill.git
cd webext-permissions-events-polyfill
git fetch origin
git checkout -b any-context origin/any-context
npm i
npm run build
npm link And then in your project npm link webext-permissions-events-polyfill |
I got around the above issue by just copying and pasting the entire file to test it out, but I realized I won't be able to use it because I'm using Since the API for Even though I don't think I can use this polyfill, thanks for putting it together! |
This polyfills doesn't use the browser API but the chrome API, which is available in both browsers regardless of In Refined GitHub I'm using this polyfill together with |
That extension works both in Firefox and Chrome:
|
If |
Hm, gotcha. I'll play around with it a bit more and let you know it goes. Thanks! |
So I've been banging my head against the wall for the last few hours trying to figure this out (thought maybe it had to do with me using Once I rebased |
Indeed, sorry for the misunderstanding, I didn't realize that I had made those important changes after I wrote that PR. I just published a prerelease under npm install webext-permissions-events-polyfill@1.0.2-1 |
Sure thing, I'll give it a try and let you know how it goes. |
Works great! Thanks again for your work on this. 🙏🏽 |
Does it work correctly across contexts? I should test it out a bit more |
Yup, that was the part that I tested (but of course, feel free to test more). I requested the permission from a non-background page and the |
It kinda works but it's also buggy. Removing a permission results in 3 callbacks:
Needs more work |
Ah, definitely should've mentioned that I only tested adding a permission and just checked if it worked as expected end-to-end so I'm glad you tested it much more thoroughly than I did! |
Firefox 77 is out with native support! |
Amazing! Thanks @fregante. |
This polyfill will exclusively work if permissions are requested/removed from the same page where the listener is. That means, if you run
chrome.permissions.request
in the background page, only the same exact page will receive the event.This works
This doesn't
If you want to request from
options.html
orpopup.html
, it won't work.Add your interest in this issue or send a PR to add support via
runtime.sendMessage
The text was updated successfully, but these errors were encountered: