1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:17:44 +00:00

LibJS: Implement a more general InitializeHostDefinedRealm AO

The existing implementation of this AO lives in Interpreter::create(),
which makes it impossible to use without also constructing an
Interpreter.

This patch adds a new Realm::initialize_host_defined_realm() and takes
the global object and global this customization steps as Function
callback objects. This will be used by LibWeb to create realms during
Document construction.
This commit is contained in:
Andreas Kling 2022-08-04 21:21:50 +02:00
parent e756b5450d
commit 8a03b17007
3 changed files with 78 additions and 10 deletions

View file

@ -64,7 +64,7 @@ ThrowCompletionOr<Object*> ShadowRealmConstructor::construct(FunctionObject& new
// 10. Perform ? SetRealmGlobalObject(realmRec, undefined, undefined).
auto* new_global_object = vm.heap().allocate_without_global_object<GlobalObject>(*realm);
realm->set_global_object(*new_global_object, nullptr);
realm->set_global_object(new_global_object, js_undefined());
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