-
Notifications
You must be signed in to change notification settings - Fork 56
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
Proposal: allow webRequest with background.persistent: false
/ SW
#148
Comments
Could you clarify, why do you believe that this API requires a persistent background page? The use cases for extension popups/tabs sound reasonable, and I'd imagine the API to work in extensions without a background script (persistent or not). I know that there were some technical reasons (implementation details) that prevented (blocking) webRequest from being supported in Chrome when event pages are enabled, but does this issue also extend to other browsers? Is this issue a bug report about Chrome, or is it broader than that? |
@Rob--W Currently I'm not aware of any reasoning behind this. I can only speculate on that. Potentially it was seen that webRequest listeners would mostly make sense when they are constantly there. But that is not necessarily true. |
|
This topic came up during today's WECG meeting. Relevant part from the meeting notes (currently pending review, will be merged and published at https://github.com/w3c/webextensions/blob/main/_minutes/2022-02-03-wecg.md)
|
Chrome didn't support webRequest in an event page because it wasn't exactly trivial to support waking up the event page and it would cause frequent restarts of the event page as such events tend to happen frequently. The support for SW, which are conceptually the same as event pages, is being implemented currently in https://crbug.com/1024211, so there's no reason it can't be made to work with an event page. Note that webRequest + webRequestBlocking as optional permissions always worked in an event page while it was running, it just didn't wake up. |
@tophf Thanks for clarifying! My use case for the webRequest API is only in non-background contexts. In which case it's a pity a permanent background page has to run for this to work. |
But you don't need the background script at all if you use webRequest only in a visible page. |
@tophf correct! Yet Google Chrome doesn't allow loading an extension with the webRequest permission and a non-persistent background page at this moment. |
As I mentioned in my comment, all you need is to use optional permissions and it'll work with a non-persistent background script. |
Firefox currently allows loading extensions with the Related: a proposal for adding support for the webRequest API in non-persistent background pages has been added to the chrome issue tracker by @Rob--W https://bugs.chromium.org/p/chromium/issues/detail?id=447270 |
Currently the webRequest and webRequestBlocking permission require a persistent background page. This seems to be an arbitrary limitation. The proposal is to allow these APIs under a non-persistent / SW API as well.
Use cases are using this API in extension popups, or in contentScripts. The background-page doesn't need to keep running in the background for this to be useful.
Edit 2022-09-01: Firefox currently allows loading extensions with the
webRequest
permission whenpersistent
is set tofalse
in mv2. In mv3, thepersistent
key is unsupported.Related: a proposal for adding support for the webRequest API in non-persistent background pages has been added to the chrome issue tracker by @Rob--W https://bugs.chromium.org/p/chromium/issues/detail?id=447270
The text was updated successfully, but these errors were encountered: