- <emu-alg><ol><li>Let <var>realm</var> be a new <emu-xref href="#realm-record" id="_ref_3862"><a href="executable-code-and-execution-contexts.html#realm-record">Realm Record</a></emu-xref>.</li><li>Perform <emu-xref aoid="CreateIntrinsics" id="_ref_3863"><a href="executable-code-and-execution-contexts.html#sec-createintrinsics">CreateIntrinsics</a></emu-xref>(<var>realm</var>).</li><li>Set <var>realm</var>.<var class="field">[[AgentSignifier]]</var> to <emu-xref aoid="AgentSignifier" id="_ref_3864"><a href="executable-code-and-execution-contexts.html#sec-agentsignifier">AgentSignifier</a></emu-xref>().</li><li>Set <var>realm</var>.<var class="field">[[GlobalEnv]]</var> to <emu-val>undefined</emu-val>.</li><li>Set <var>realm</var>.<var class="field">[[TemplateMap]]</var> to a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_3865"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>Let <var>newContext</var> be a new <emu-xref href="#sec-execution-contexts" id="_ref_3866"><a href="executable-code-and-execution-contexts.html#sec-execution-contexts">execution context</a></emu-xref>.</li><li>Set the Function of <var>newContext</var> to <emu-val>null</emu-val>.</li><li>Set the <emu-xref href="#realm" id="_ref_3867"><a href="executable-code-and-execution-contexts.html#realm">Realm</a></emu-xref> of <var>newContext</var> to <var>realm</var>.</li><li>Set the ScriptOrModule of <var>newContext</var> to <emu-val>null</emu-val>.</li><li>Push <var>newContext</var> onto the <emu-xref href="#execution-context-stack" id="_ref_3868"><a href="executable-code-and-execution-contexts.html#execution-context-stack">execution context stack</a></emu-xref>; <var>newContext</var> is now the <emu-xref href="#running-execution-context" id="_ref_3869"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>.</li><li>If the <emu-xref href="#host" id="_ref_3870"><a href="overview.html#host">host</a></emu-xref> requires use of an <emu-xref href="#exotic-object" id="_ref_3871"><a href="ecmascript-data-types-and-values.html#exotic-object">exotic object</a></emu-xref> to serve as <var>realm</var>'s <emu-xref href="#sec-global-object" id="_ref_3872"><a href="global-object.html#sec-global-object">global object</a></emu-xref>, then<ol><li>Let <var>global</var> be such an object created in a <emu-xref href="#host-defined" id="_ref_3873"><a href="overview.html#host-defined">host-defined</a></emu-xref> manner.</li></ol></li><li>Else,<ol><li>Let <var>global</var> be <emu-xref aoid="OrdinaryObjectCreate" id="_ref_3874"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryobjectcreate">OrdinaryObjectCreate</a></emu-xref>(<var>realm</var>.<var class="field">[[Intrinsics]]</var>.[[<emu-xref href="#sec-properties-of-the-object-prototype-object" id="_ref_3875"><a href="fundamental-objects.html#sec-properties-of-the-object-prototype-object">%Object.prototype%</a></emu-xref>]]).</li></ol></li><li>If the <emu-xref href="#host" id="_ref_3876"><a href="overview.html#host">host</a></emu-xref> requires that the <code>this</code> binding in <var>realm</var>'s global scope return an object other than the <emu-xref href="#sec-global-object" id="_ref_3877"><a href="global-object.html#sec-global-object">global object</a></emu-xref>, then<ol><li>Let <var>thisValue</var> be such an object created in a <emu-xref href="#host-defined" id="_ref_3878"><a href="overview.html#host-defined">host-defined</a></emu-xref> manner.</li></ol></li><li>Else,<ol><li>Let <var>thisValue</var> be <var>global</var>.</li></ol></li><li>Set <var>realm</var>.<var class="field">[[GlobalObject]]</var> to <var>global</var>.</li><li>Set <var>realm</var>.<var class="field">[[GlobalEnv]]</var> to <emu-xref aoid="NewGlobalEnvironment" id="_ref_3879"><a href="executable-code-and-execution-contexts.html#sec-newglobalenvironment">NewGlobalEnvironment</a></emu-xref>(<var>global</var>, <var>thisValue</var>).</li><li>Perform ? <emu-xref aoid="SetDefaultGlobalBindings" id="_ref_3880"><a href="executable-code-and-execution-contexts.html#sec-setdefaultglobalbindings" class="e-user-code">SetDefaultGlobalBindings</a></emu-xref>(<var>realm</var>).</li><li>Create any <emu-xref href="#host-defined" id="_ref_3881"><a href="overview.html#host-defined">host-defined</a></emu-xref> <emu-xref href="#sec-global-object" id="_ref_3882"><a href="global-object.html#sec-global-object">global object</a></emu-xref> properties on <var>global</var>.</li><li>Return <emu-const>unused</emu-const>.</li></ol></emu-alg>
0 commit comments