You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to MV3, we can't spin up web workers from background scripts and due to cross-origin policies, we also can't spin up the web worker if we're running it within a content script on another origin, e.g. let's say this is a youtube extension, the content script wouldn't be able to spin up the web worker there as it'll
This makes it seem that for browser extensions that use MV3, there isn't a way to run the web worker unless we're running the extension on origins that we specifically own and can modify the content policy. Am I missing something here? I've gone down a huge rabbit hole today trying to get PGlite working on my extension and due to this limitation it feels like it won't work and, due to the limitations of MV3, can't work. Is this correct? Would be great to get a second opinion here on whether this is true and if so add it to the docs so others know not to try this out. Thanks
The text was updated successfully, but these errors were encountered:
hey @callum-gander - not sure if this addresses your issue: my extension operates on all origins http://*/* and I use the navigator's web lock API in lieu of the multi-tab worker, which I found, like you, difficult to adapt to a browser extension. This is my repo if it helps.
In short, I have my content scripts use chrome.runtime.sendMessage to the service workers in the background script, and these workers in turn get a reference to the pglite instance wrapped around the web lock API.
I'm not really up to speed on MV3, and browser extension in general. I do know they can complex for things like workers though.
You don't need to you the PGliteWorker api, you can run it on any thread you want. It sounds like @ashrielbrian has a good enough solution (the PGliteWorker api uses the web locks api itself), I hope that helped!
I'd like to expand the support for the worker, but it's not high on our priority list now.
I'm going to close this issue for now as out of scope.
So, I could be wrong here but as I understand it:
This makes it seem that for browser extensions that use MV3, there isn't a way to run the web worker unless we're running the extension on origins that we specifically own and can modify the content policy. Am I missing something here? I've gone down a huge rabbit hole today trying to get PGlite working on my extension and due to this limitation it feels like it won't work and, due to the limitations of MV3, can't work. Is this correct? Would be great to get a second opinion here on whether this is true and if so add it to the docs so others know not to try this out. Thanks
The text was updated successfully, but these errors were encountered: