Skip to content

[Stage 3] Web APIs to be exposed to ShadowRealms #393

@leobalter

Description

@leobalter

Back in September 2023, TC39 agreed to move this proposal to Stage 2 setting a missing requirement for Stage 3 to provide a list of suitable APIs to be exposed to ShadowRealms, along with sufficient tests to ensure correct behaviour in implementations.

Salesforce is currently working with Igalia to organize this work. Igalia produced the following list mapping all the names below:

Web APIs exposed in ShadowRealm

Defined in WebIDL as of whatwg/html#9893.

Checklist indicates which APIs are already covered in WPT.

(Checklist updated by @ptomato)

In Progress

Additional names being added within specs PRs and WPT coverage:

Additional rationale regarding Workers

With rationale for not exposing in ShadowRealm:

  • browser state: ShadowRealm code shouldn't be able to access any information about the browser or its global state.
  • canvas: Without the ability to pass objects into a ShadowRealm it doesn't make much sense to include HTML canvas APIs with no way to display the canvas.
  • host access: ShadowRealm code shouldn't be able to access information about or resources on the host.
  • multimedia: ShadowRealm code doesn't need to do anything with multimedia APIs, since there's no way to display multimedia.
  • network access: ShadowRealm code shouldn't be able to access the network.
  • secure context: ShadowRealm isn't a secure context, so APIs annotated with [SecureContext] aren't exposed.
  • timers: ShadowRealm code shouldn't be able to access timing information other than through Date and Temporal.Now.
  • workers: ShadowRealm can't launch workers.
    • communication channels: ShadowRealm doesn't include communication channels such as web sockets, postMessage, etc. This is a level of I/O that is more broad than ShadowRealm should have by default.

Inclusion criteria from specs that are at least Candidate Recommendation, omitting any W3C Working Drafts, API drafts from WICG, etc. Also omitting worker-specific APIs only exposed in workers and not also in window.

Blob and related APIs (currently W3C Working Draft) could arguably be included but initially we decided not to expose them because they are somewhat tied to fetch and file APIs. The HTML spec references Blob, but only in APIs that are not available in ShadowRealm.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions