Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove [[ExecutionContext]] #320

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 34 additions & 26 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -320,17 +320,10 @@ <h1>
1. If _body_ Contains |SuperCall| is *true*, throw a *SyntaxError* exception.
1. Let _strictEval_ be IsStrict of _script_.
1. Let _runningContext_ be the running execution context.
1. Let _lexEnv_ be NewDeclarativeEnvironment(_evalRealm_.[[GlobalEnv]]).
1. Let _varEnv_ be _evalRealm_.[[GlobalEnv]].
1. If _strictEval_ is *true*, set _varEnv_ to _lexEnv_.
1. If _runningContext_ is not already suspended, suspend _runningContext_.
1. Let _evalContext_ be a new ECMAScript code execution context.
1. Set _evalContext_'s Function to *null*.
1. Set _evalContext_'s Realm to _evalRealm_.
1. Set _evalContext_'s ScriptOrModule to *null*.
1. Set _evalContext_'s VariableEnvironment to _varEnv_.
1. Set _evalContext_'s LexicalEnvironment to _lexEnv_.
1. Set _evalContext_'s PrivateEnvironment to *null*.
1. Let _evalContext_ be GetShadowRealmContext(_evalRealm_, _strictEval_).
1. Let _lexEnv_ be _evalContext_'s LexicalEnvironment.
1. Let _varEnv_ be _evalContext_'s VariableEnvironment.
1. Push _evalContext_ onto the execution context stack; _evalContext_ is now the running execution context.
1. Let _result_ be Completion(EvalDeclarationInstantiation(_body_, _varEnv_, _lexEnv_, *null*, _strictEval_)).
1. If _result_.[[Type]] is ~normal~, then
Expand Down Expand Up @@ -361,15 +354,15 @@ <h1>
_specifierString_: a String,
_exportNameString_: a String,
_callerRealm_: a Realm Record,
_evalContext_: an execution context,
_evalRealm_: a Realm Record,
): an ECMAScript language value
</h1>
<dl class="header">
<dt>description</dt>
<dd>...</dd>
</dl>
<emu-alg>
1. Assert: _evalContext_ is an execution context associated to a ShadowRealm instance's [[ExecutionContext]].
1. Let _evalContext_ be GetShadowRealmContext(_evalRealm_, *true*).
1. Let _innerCapability_ be ! NewPromiseCapability(%Promise%).
1. Let _runningContext_ be the running execution context.
1. If _runningContext_ is not already suspended, suspend _runningContext_.
Expand Down Expand Up @@ -447,10 +440,35 @@ <h1>
</dl>
<emu-alg>
1. Perform ? RequireInternalSlot(_O_, [[ShadowRealm]]).
1. Perform ? RequireInternalSlot(_O_, [[ExecutionContext]]).
1. Return ~unused~.
</emu-alg>
</emu-clause>

<emu-clause id="sec-getshadowrealmcontext" type="abstract operation">
<h1>
GetShadowRealmContext (
_shadowRealmRecord_: a Realm Record,
_strictEval_: a Boolean,
): an ECMAScript code execution context
</h1>
<dl class="header">
<dt>description</dt>
<dd></dd>
</dl>
<emu-alg>
1. Let _lexEnv_ be NewDeclarativeEnvironment(_shadowRealmRecord_.[[GlobalEnv]]).
1. Let _varEnv_ be _shadowRealmRecord_.[[GlobalEnv]].
1. If _strictEval_ is *true*, set _varEnv_ to _lexEnv_.
1. Let _context_ be a new ECMAScript code execution context.
1. Set _context_'s Function to *null*.
1. Set _context_'s Realm to _shadowRealmRecord_.
1. Set _context_'s ScriptOrModule to *null*.
1. Set _context_'s VariableEnvironment to _varEnv_.
1. Set _context_'s LexicalEnvironment to _lexEnv_.
1. Set _context_'s PrivateEnvironment to *null*.
1. Return _context_.
</emu-alg>
</emu-clause>
</emu-clause>

<emu-clause id="sec-shadowrealm-constructor">
Expand All @@ -469,14 +487,9 @@ <h1>ShadowRealm ( )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg>
1. If NewTarget is *undefined*, throw a *TypeError* exception.
1. Let _O_ be ? OrdinaryCreateFromConstructor(NewTarget, *"%ShadowRealm.prototype%"*, « [[ShadowRealm]], [[ExecutionContext]] »).
1. Let _O_ be ? OrdinaryCreateFromConstructor(NewTarget, *"%ShadowRealm.prototype%"*, « [[ShadowRealm]] »).
1. Let _realmRec_ be CreateRealm().
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]]).
Expand Down Expand Up @@ -538,8 +551,8 @@ <h1>ShadowRealm.prototype.importValue ( _specifier_, _exportName_ )</h1>
1. Let _specifierString_ be ? ToString(_specifier_).
1. If _exportName_ is not a String, throw a *TypeError* exception.
1. Let _callerRealm_ be the current Realm Record.
1. Let _evalContext_ be _O_.[[ExecutionContext]].
1. Return ShadowRealmImportValue(_specifierString_, _exportName_, _callerRealm_, _evalContext_).
1. Let _evalRealm_ be _O_.[[ShadowRealm]].
1. Return ShadowRealmImportValue(_specifierString_, _exportName_, _callerRealm_, _evalRealm_).
</emu-alg>

<emu-note type=editor>
Expand Down Expand Up @@ -571,11 +584,6 @@ <h1>Properties of ShadowRealm Instances</h1>
<td>Realm Record</td>
<td>The Realm Record for the initial execution context.</td>
</tr>
<tr>
<td>[[ExecutionContext]]</td>
<td>Execution context</td>
<td>An execution context wherein the current Realm is this [[ShadowRealm]].</td>
</tr>
</tbody>
</table>
</emu-table>
Expand Down