MISSING INSTRUCTIONS for the initialization of the global scope execution context in ES2020?

Hello, as I understand it, the initialization of the execution context for the global scope of a script is defined in ES2019 by Section 8.6 RunJobs ( ). https://www.ecma-international.org/ecma-262/10.0/index.html#sec-runjobs

The "RunJobs" operation then performs the following:

Perform EnqueueJob("ScriptJobs", ScriptEvaluationJob, « sourceText, hostDefined »).

Now, upon reading the ES2020 version of the Spec, I have realized that Section 8.6 RunJobs ( ) as well as Section 15.1.12 Runtime Semantics: ScriptEvaluationJob both have been removed. As such, it seems to me that ES2020 does not provide any direct instructions for the setup of the first execution context (for the global scope) at the start of execution of a given "Script".

Can somebody please tell me why the above mentioned sections have been removed in ES2020 or perhaps where instructions analogous to those missing can be found in ES2020?

Thank you, I would be very grateful!

They were removed because they didn't correspond to the actual behavior of hosts; see discussion in #735 and #1597. The main entrypoint for scripts is now ScriptEvaluation, as used in HTML. That API assumes a Realm has already been set up, which the host needs to do itself by invoking InitializeHostDefinedRealm (as is done in HTML).

1 Like

Thank you! That was helpful. Although after reading though the comments under PR#735 and PR#1597, I have to say that, as a personal opinion, I concur with some of the suggestions raised in those threads suggesting that perhaps information could be given regarding how "ScriptEvaluation", "InitializaHostDefinedRealm" and other operations newly elevated as top-level shall be used by a "sensible" host. (Maybe this could done in an annex or as prose notes). Now that I am aware of the relevant sections of the HTML spec, it does make sense. However, a reader who is not a language implementer may be left pretty confused by consuming the ES2020 Spec alone, especially since the aforementioned top-level operations are not explicitly mentioned as top-level and no context is given for their usage. Thanks for baring with me through my little rant as a casual reader of the Spec. Now, do you know if there is any open PR working towards addressing my concerns?

1 Like