1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:17:34 +00:00

LibJS: Let Shape store a Realm instead of a GlobalObject

This is a cautious first step towards being able to create JS objects
before a global object has been instantiated.
This commit is contained in:
Andreas Kling 2022-08-01 20:27:20 +02:00
parent 7a6935a2ff
commit 50d951aea2
22 changed files with 104 additions and 55 deletions

View file

@ -63,9 +63,9 @@ ThrowCompletionOr<Object*> ShadowRealmConstructor::construct(FunctionObject& new
auto* object = TRY(ordinary_create_from_constructor<ShadowRealm>(global_object, new_target, &GlobalObject::shadow_realm_prototype, *realm, move(context)));
// 10. Perform ? SetRealmGlobalObject(realmRec, undefined, undefined).
auto* new_global_object = vm.heap().allocate_without_global_object<GlobalObject>();
new_global_object->initialize_global_object();
auto* new_global_object = vm.heap().allocate_without_global_object<GlobalObject>(*realm);
realm->set_global_object(*new_global_object, nullptr);
new_global_object->initialize_global_object();
// 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