8.2.3 SetRealmGlobalObject ( realmRec, globalObj, thisValue )

具有参数 realmRecglobalObj thisValue 的抽象操作SetRealmGlobalObject执行以下步骤:

  1. 如果 globalObj undefined,那么

a. 使 intrinsics 变为 realmRec.[[Intrinsics]]。 b. 使 globalObj 变为 ObjectCreate(intrinsics.[[%ObjectPrototype%]])。

2.断言: Type(globalObj) 为 Object 类型。

3.如果 thisValue undefined,则使 thisValue 变为 globalObj

4.设置 realmRec.[[GlobalObject]] 为 globalObj

5.使 newGlobalEnv 变为 NewGlobalEnvironment(globalObj, thisValue)。

6.设置 realmRec.[[GlobalEnv]] 为 newGlobalEnv

7.返回 realmRec

results matching ""

    No results matching ""