Open Bug 1978074 Opened 5 months ago Updated 5 months ago

`navigator.serviceWorker` is available on blob worker on Firefox but not on Chrome

Categories

(Core :: DOM: Service Workers, defect)

defect

Tracking

()

People

(Reporter: saschanaz, Unassigned, NeedInfo)

References

Details

(Keywords: parity-chrome)

new Worker(URL.createObjectURL(new Blob([`
  console.log("navigator.serviceWorker", navigator.serviceWorker)
`])))

This logs ServiceWorkerContainer on Gecko but undefined on Blink. isSecureContext is true on both engines, but then navigator.serviceWorker.getRegistration() fails with NS_ERROR_MALFORMED_URI on Gecko, so maybe it shouldn't exist at all?

I don't see a normative requirement on the spec other than [SecureContext] IDL extended attribute. The spec has this note: https://w3c.github.io/ServiceWorker/#control-and-use-worker-client

Window clients and worker clients with a blob URL can inherit the active service worker of their creator document or owner, but if the request’s origin is not the same as the origin of their creator document or owner, the active service worker is set to null.

Meaning this is supposed to work?

Flags: needinfo?(bugmail)
You need to log in before you can comment on or make changes to this bug.