Re: [w3c/ServiceWorker] CORS preflight for static import in a module service worker (#1574)

ikram1201 left a comment (w3c/ServiceWorker#1574)

I'd like to take this one, following @monica-ch's triage note and @wanderview's suggestion above: move the "Append `Service-Worker`/`script`" step in Update's perform the fetch hook to after the isTopLevel check, so only the top-level script request carries the header, as with `importScripts()`.

I checked current behavior with a new WPT test: a same-origin static import must not carry the header, and a cross-origin static import must load without `Access-Control-Allow-Headers: Service-Worker`. Chrome 156 and Firefox 159 already pass both, so this change aligns the spec with what ships. I'll open the spec PR and a companion WPT PR shortly.

I'd keep the `updateViaCache: "imports"` and byte-for-byte points @jakearchibald raised for a separate issue, as suggested in the thread, unless you'd rather handle them here.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1574#issuecomment-7073399670
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/ServiceWorker/issues/1574/7073399670@github.com>

Received on Sunday, 22 November 2026 03:14:11 UTC