ShadowRealm
- Category
- JavaScript
- Type
- Chromium catches up
- Status
- In development (Chrome In development)
- Intent stage
- Start prototyping
WPT details: Tested in test262: https://github.com/tc39/test262/tree/main/test/built-ins/ShadowRealm Various tests in WPT for shadow realms integration with other web standards.
Summary
ShadowRealm is a TC39 proposal to add an in-process, synchronous way to create a new global environment with its own global object and its own set of built-ins and intrinsics. See the proposal explainer at https://github.com/tc39/proposal-shadowrealm/blob/main/explainer.md
Motivation
The ShadowRealm API provides a way to run trusted code in a fresh global environment, which has use cases for virtualization, virtual DOM, and other execution of trusted 3rd party code. Please note that because ShadowRealm is a synchronous, in-process (e.g. no separate address space protection) API, it is not a sufficient security boundary for many threat models. It is not a generic sandboxing primitive for security purposes.
Standards & signals
- Specification: https://tc39.es/proposal-shadowrealm/
- Firefox: No signal — https://bugzilla.mozilla.org/show_bug.cgi?id=1566145
- Safari: No signal — https://bugs.webkit.org/show_bug.cgi?id=230602
- Web developers: No signals
- Tracking bug: https://bugs.chromium.org/p/v8/issues/detail?id=11989
Ecosystem
- Web Platform Tests: https://wpt.fyi/results/?q=test%2Fbuilt-ins%2FShadowRealm
- Chrome Platform Showcase: https://chrome-platform-showcase.paulkinlan-ea.deno.net/features
- GenDN reference: https://gendn.paulkinlan-ea.deno.net/features
- chrome.dev demos search: https://www.google.com/search?q=site%3Achrome.dev+ShadowRealm
- MDN Web Docs: https://developer.mozilla.org/en-US/search?q=ShadowRealm
- Baseline status: https://webstatus.dev/?q=ShadowRealm
Docs: https://docs.google.com/document/d/1SWFGpiSdrBwErDNot8rqMyBjKGC3WDArcLnGg7MX6SE/edit?usp=sharing https://docs.google.com/document/d/1k9OZxtbKmzENOMzahmm2C0uBNRc_pVLXMSoKsrkJJBw/edit?usp=sharing
Explainers: https://github.com/tc39/proposal-shadowrealm/blob/main/explainer.md