Stage 2.7
Classification: API Change
Human Validated: KW
Title: ShadowRealm
Authors: Caridy Patiño, Jean-Francois Paradis
Champions: Dave Herman, Mark Miller, Caridy Patiño, Leo Balter, Rick Waldron, Chengzhong Wu
Last Presented: February 2024
Stage Upgrades:
Stage 1: 2017-01-30
Stage 2: 2018-05-25
Stage 2.7: 2025-02-10
Stage 3: NA
Stage 4: NA
Last Commit: 2025-02-10
Topics: security others realms
Keywords: virtualization global isolation security modularity
GitHub Link: https://github.com/tc39/proposal-shadowrealm
GitHub Note Link: https://github.com/tc39/notes/blob/HEAD/meetings/2024-02/feb-7.md#shadowrealms-update

Proposal Description:

ECMAScript spec proposal for ShadowRealm API

Status

Champions

  • @dherman
  • @caridy
  • @erights
  • @leobalter
  • @rwaldron
  • @legendecas

Index

What are ShadowRealms?

ShadowRealms are a distinct global environment, with its own global object containing its own intrinsics and built-ins (standard objects that are not bound to global variables, like the initial value of Object.prototype).

See more at the explainer document.

API (TypeScript Format)

declare class ShadowRealm {
    constructor();
    importValue(specifier: string, bindingName: string): Promise<PrimitiveValueOrCallable>;
    evaluate(sourceText: string): PrimitiveValueOrCallable;
}

See some examples in the Explainer file.

Presentations

History

Contributing

Updating the spec text for this proposal

The source for the spec text is located in spec.html and it is written in ecmarkup language.

When modifying the spec text, you should be able to build the HTML version by using the following command:

npm install
npm run build
open dist/index.html

Alternatively, you can use npm run watch.