Requests from WebExtensions aren't handled by service workers
Categories
(Core :: DOM: Service Workers, enhancement, P3)
Tracking
()
People
(Reporter: david.konir, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0
Steps to reproduce:
- Visit a website that installs a service worker
- In an extension background page, initiate a fetch(), XmlHttpRequest, or browser.downloads.download() with a URL that should be handled by the service worker
Actual results:
Extension receives result directly from the website.
Expected results:
Service worker intercepts and handles the request.
Comment 1•5 years ago
|
||
I'm inclined to say that the current behavior is probably correct.
Reporter | ||
Comment 2•5 years ago
|
||
(In reply to Kris Maglione [:kmag] from comment #1)
I'm inclined to say that the current behavior is probably correct.
It would seem so, yes. But then extensions can't access resources that are served by service workers while offline.
Updated•5 years ago
|
Comment 3•5 years ago
|
||
(In reply to David Konir from comment #2)
(In reply to Kris Maglione [:kmag] from comment #1)
I'm inclined to say that the current behavior is probably correct.
Agreed. From a spec perspective, what's being discussed here amounts to foreign fetch which is no longer a thing under consideration.
It would seem so, yes. But then extensions can't access resources that are served by service workers while offline.
Have you tried initiating the fetch from a content script using fetch/XHR from the controlled page?
It could make sense to have specific APIs for something like this, but it's probably better to understand what the motivating use-case is first. Can you elaborate on the use-case?
In particular, while dispatching fake navigation fetches would probably work out okay, specific serviceworkers may expect clients to already exist for sub-resource fetches and/or be more than a naive proxy. In many cases, having the actual page setup in place is more likely to work out consistently.
Comment 4•5 years ago
|
||
This reads like a potential spec change, not like a defect?
Comment 5•5 years ago
|
||
There's no real specification covering extensions. We can do whatever we want. It seems fine to me to close this particular request given that there's been no reply in 7 months though.
Updated•5 years ago
|
Description
•