ipfs / service-worker-gateway

[WIP EXPERIMENT] IPFS Gateway implemented in Service Worker
https://inbrowser.link
Other
17 stars 8 forks source link

User-friendly error on redundant service worker registration #32

Open lidel opened 4 months ago

lidel commented 4 months ago

Problem

What happens when service worker gateway is used to load website which has own service worker code?

IIUC if the scope of the new service worker is the same as or a subset of the scope of the existing service worker, the new service worker will not be able to take control until the existing service worker is unregistered or its scope is changed.

AFAIK attempting to register a service worker with a conflicting scope won't result in an error, but it won't replace the existing service worker either, creating situation which is hell to debug and reason about.

Solution

SgtPooki commented 4 months ago

Do we have an example website in this state? The only one I know of is https://helia-service-worker-gateway.on.fleek.co/ right now which you can test at https://helia--service--worker--gateway-on-fleek-co.ipfs.sw.sgtpooki.com

image