mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:37:36 +00:00
LibJS: Pass Realm to GlobalObject::initialize_global_object()
Global object initialization is tightly coupled to realm creation, so simply pass it to the function instead of relying on the non-standard 'associated realm' concept, which I'd like to remove later. This works essentially the same way as regular Object::initialize() now. Additionally this allows us to forward the realm to GlobalObject's add_constructor() / initialize_constructor() helpers, so they set the correct realm on the allocated constructor function object.
This commit is contained in:
parent
b465f46e00
commit
7c468b5a77
18 changed files with 76 additions and 79 deletions
|
@ -64,7 +64,7 @@ ThrowCompletionOr<Object*> ShadowRealmConstructor::construct(FunctionObject& new
|
|||
// 10. Perform ? SetRealmGlobalObject(realmRec, undefined, undefined).
|
||||
auto* new_global_object = vm.heap().allocate_without_realm<GlobalObject>(*realm);
|
||||
realm->set_global_object(new_global_object, nullptr);
|
||||
new_global_object->initialize_global_object();
|
||||
new_global_object->initialize_global_object(*realm);
|
||||
|
||||
// TODO: I don't think we should have these exactly like this, that doesn't work well with how
|
||||
// we create global objects. Still, it should be possible to make a ShadowRealm with a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue