1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:37:45 +00:00

LibJS+LibWeb: Restore type safety of Realm::set_global_object()

The changes from 8a03b17 to allow any JS::Value aren't a good fit, as
shown by the excessive amount of verify_cast needed :^)
This commit is contained in:
Linus Groh 2022-08-06 01:01:13 +01:00 committed by Andreas Kling
parent 64b29eb459
commit c8f1651761
10 changed files with 27 additions and 36 deletions

View file

@ -47,13 +47,11 @@ public:
interpreter->m_global_execution_context = MUST(Realm::initialize_host_defined_realm(
vm,
[&](Realm& realm) -> Value {
[&](Realm& realm) -> GlobalObject* {
global_object = interpreter->heap().allocate_without_global_object<GlobalObjectType>(realm, forward<Args>(args)...);
return global_object;
},
[](Realm&) -> Value {
return js_undefined();
}));
nullptr));
// NOTE: These are not in the spec.
static FlyString global_execution_context_name = "(global execution context)";