From 28b0cc3f749ddcbb05290f4481bddf5b8253a4c7 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Tue, 29 Oct 2024 17:55:56 +0100 Subject: [PATCH] Rewrite the ShadowRealm constructor with InitializeHostDefinedRealm (#409) The current prose no longer works after https://github.com/tc39/ecma262/pull/3139. --- package.json | 4 ++-- spec.html | 16 +++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index c78094c..573a0df 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/spec.html b/spec.html index 0f24c33..6707f6e 100644 --- a/spec.html +++ b/spec.html @@ -472,16 +472,14 @@

ShadowRealm ( )

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_.