9.6 InitializeHostDefinedRealm ( )
The abstract operation InitializeHostDefinedRealm takes no arguments and returns either a
- Let realm be
CreateRealm (). - Let newContext be a new
execution context . - Set the Function of newContext to
null . - Set the
Realm of newContext to realm. - Set the ScriptOrModule of newContext to
null . - Push newContext onto the
execution context stack ; newContext is now therunning execution context . - If the
host requires use of anexotic object to serve as realm'sglobal object , let global be such an object created in ahost-defined manner. Otherwise, let global beundefined , indicating that anordinary object should be created as theglobal object . - If the
host requires that thethis
binding in realm's global scope return an object other than theglobal object , let thisValue be such an object created in ahost-defined manner. Otherwise, let thisValue beundefined , indicating that realm's globalthis
binding should be theglobal object . - Perform
SetRealmGlobalObject (realm, global, thisValue). - Let globalObj be ?
SetDefaultGlobalBindings (realm). - Create any
host-defined global object properties on globalObj. - Return
unused .