[w3c/ServiceWorker] Flag ServiceWorkerGlobalScope as SecureContext (PR #1704)

Context for this is Open Web Docs people looking into automating the handling of "this feature is available only in secure contexts" banners in MDN pages. This led to the discussion with @annevk in https://github.com/w3c/webref/issues/1142#issuecomment-1927219703

When it is set, the `[SecureContext]` IDL extended attribute explicitly gives the information. That said, to avoid redundancies, that attribute is usually not set on interfaces that are exposed (through `[Exposed=xxx]`) to globals that are already restricted to secure contexts.

The Service workers spec is clear that [service workers must execute in secure contexts](https://w3c.github.io/ServiceWorker/#secure-context). However, it does not fully say so in the IDL itself. More specifically, when an interface defined in another spec has `[Exposed=ServiceWorker]`, that's a reference to the `ServiceWorkerGlobalScope` interface, and that interface does not have a `[SecureContext]` attribute.

This PR proposes to add a `[SecureContext]` attribute to `ServiceWorkerGlobalScope` to make it possible to derive the fact that service workers must execute in secure contexts automatically.

This approach is consistent with the way [`WorkletGlobalScope`](https://html.spec.whatwg.org/multipage/worklets.html#worklets-global), from which a number of other globals inherit, is defined.

You can view, comment on, or merge this pull request online at:

  https://github.com/w3c/ServiceWorker/pull/1704

-- Commit Summary --

  * Flag ServiceWorkerGlobalScope as SecureContext

-- File Changes --

    M docs/index.bs (2)

-- Patch Links --

https://github.com/w3c/ServiceWorker/pull/1704.patch
https://github.com/w3c/ServiceWorker/pull/1704.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/pull/1704
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/ServiceWorker/pull/1704@github.com>

Received on Wednesday, 7 February 2024 14:56:30 UTC