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

Ladybird: Update for LibJS realm changes

This commit is contained in:
Luke Wilde 2022-08-23 17:25:10 +01:00 committed by Andrew Kaster
parent a14b00e046
commit c9e6967d7b
4 changed files with 17 additions and 12 deletions

View file

@ -26,16 +26,17 @@ ConsoleClient::ConsoleClient(JS::Console& console, WeakPtr<JS::Interpreter> inte
JS::DeferGC defer_gc(m_interpreter->heap());
auto& vm = m_interpreter->vm();
auto& global_object = m_interpreter->global_object();
auto& realm = m_interpreter->realm();
auto& window = static_cast<Web::Bindings::WindowObject&>(realm.global_object());
auto console_global_object = m_interpreter->heap().allocate_without_global_object<ConsoleGlobalObject>(*global_object.associated_realm(), static_cast<Web::Bindings::WindowObject&>(global_object));
auto console_global_object = m_interpreter->heap().allocate_without_realm<ConsoleGlobalObject>(realm, window);
// NOTE: We need to push an execution context here for NativeFunction::create() to succeed during global object initialization.
// It gets removed immediately after creating the interpreter in Document::interpreter().
auto& eso = verify_cast<Web::HTML::EnvironmentSettingsObject>(*m_interpreter->realm().host_defined());
vm.push_execution_context(eso.realm_execution_context());
console_global_object->set_associated_realm(m_interpreter->realm());
console_global_object->initialize_global_object();
console_global_object->initialize_global_object(realm);
vm.pop_execution_context();
m_console_global_object = JS::make_handle(console_global_object);