Flag ServiceWorkerGlobalScope as SecureContext #1704
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 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 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. 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 theServiceWorkerGlobalScope
interface, and that interface does not have a[SecureContext]
attribute.This PR proposes to add a
[SecureContext]
attribute toServiceWorkerGlobalScope
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
, from which a number of other globals inherit, is defined.Preview | Diff