Skip to content

Commit

Permalink
Rewrite the ShadowRealm constructor with InitializeHostDefinedRealm (#…
Browse files Browse the repository at this point in the history
…409)

The current prose no longer works after tc39/ecma262#3139.
  • Loading branch information
Ms2ger authored Oct 29, 2024
1 parent 4c88d76 commit 28b0cc3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"watch": "npm run build -- --watch"
},
"devDependencies": {
"@tc39/ecma262-biblio": "=2.1.2719",
"ecmarkup": "^18.0.0"
"@tc39/ecma262-biblio": "=2.1.2778",
"ecmarkup": "^19.1.0"
}
}
16 changes: 7 additions & 9 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -472,16 +472,14 @@ <h1>ShadowRealm ( )</h1>
<emu-alg>
1. If NewTarget is *undefined*, throw a *TypeError* exception.
1. Let _O_ be ? OrdinaryCreateFromConstructor(NewTarget, *"%ShadowRealm.prototype%"*, « [[ShadowRealm]], [[ExecutionContext]] »).
1. Let _realmRec_ be CreateRealm().
1. Let _callerContext_ be the running execution context.
1. Perform ? InitializeHostDefinedRealm().
1. Let _innerContext_ be the running execution context.
1. Remove _innerContext_ from the execution context stack and restore _callerContext_ as the running execution context.
1. Set _O_.[[ExecutionContext]] to _innerContext_.
1. Let _realmRec_ be the Realm of _innerContext_.
1. Set _O_.[[ShadowRealm]] to _realmRec_.
1. Let _context_ be a new execution context.
1. Set the Function of _context_ to *null*.
1. Set the Realm of _context_ to _realmRec_.
1. Set the ScriptOrModule of _context_ to *null*.
1. Set _O_.[[ExecutionContext]] to _context_.
1. Perform SetRealmGlobalObject(_realmRec_, *undefined*, *undefined*).
1. Perform ? SetDefaultGlobalBindings(_O_.[[ShadowRealm]]).
1. Perform ? HostInitializeShadowRealm(_O_.[[ShadowRealm]]).
1. Perform ? HostInitializeShadowRealm(_realmRec_).
1. Return _O_.
</emu-alg>
</emu-clause>
Expand Down

0 comments on commit 28b0cc3

Please sign in to comment.