Closed Bug 1576769 Opened 5 years ago Closed 5 years ago

Requests from WebExtensions aren't handled by service workers

Categories

(Core :: DOM: Service Workers, enhancement, P3)

68 Branch
enhancement

Tracking

()

RESOLVED INCOMPLETE

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.

I'm inclined to say that the current behavior is probably correct.

Component: General → DOM: Service Workers
Product: WebExtensions → Core
Version: Firefox 68 → 68 Branch

(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.

Priority: -- → P3

(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.

Flags: needinfo?(david.konir)

This reads like a potential spec change, not like a defect?

Type: defect → enhancement
Flags: needinfo?(david.konir) → needinfo?(annevk)

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.

Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → INCOMPLETE
Flags: needinfo?(annevk)
You need to log in before you can comment on or make changes to this bug.