Skip to content

Commit 0782416

Browse files
committed
Flag ServiceWorkerGlobalScope as SecureContext
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 in: w3c/webref#1142 (comment) When it is set, the `[SecureContext]` IDL extended attribute explicitly gives the information. That said, to avoid redundancies, that attribute is not set on interfaces that are exposed (through `[Exposed=xxx]`) on 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 commit adds the `[SecureContext]` attribute to `ServiceWorkerGlobalScope`. This approach is consistent with the way `WorkletGlobalScope`, from which a number of other globals inherit, is defined: https://html.spec.whatwg.org/multipage/worklets.html#worklets-global
1 parent 4711a07 commit 0782416

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/index.bs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ spec: storage; urlPrefix: https://storage.spec.whatwg.org/
10601060
<h3 id="serviceworkerglobalscope-interface">{{ServiceWorkerGlobalScope}}</h3>
10611061

10621062
<pre class="idl">
1063-
[Global=(Worker,ServiceWorker), Exposed=ServiceWorker]
1063+
[Global=(Worker,ServiceWorker), Exposed=ServiceWorker, SecureContext]
10641064
interface ServiceWorkerGlobalScope : WorkerGlobalScope {
10651065
[SameObject] readonly attribute Clients clients;
10661066
[SameObject] readonly attribute ServiceWorkerRegistration registration;

0 commit comments

Comments
 (0)