summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Ladybird/ConsoleClient.cpp3
-rw-r--r--Ladybird/ConsoleGlobalObject.cpp5
-rw-r--r--Ladybird/ConsoleGlobalObject.h2
3 files changed, 6 insertions, 4 deletions
diff --git a/Ladybird/ConsoleClient.cpp b/Ladybird/ConsoleClient.cpp
index fbafed4f5f..8f44aa444a 100644
--- a/Ladybird/ConsoleClient.cpp
+++ b/Ladybird/ConsoleClient.cpp
@@ -28,12 +28,13 @@ ConsoleClient::ConsoleClient(JS::Console& console, WeakPtr<JS::Interpreter> inte
auto& vm = m_interpreter->vm();
auto& global_object = m_interpreter->global_object();
- auto console_global_object = m_interpreter->heap().allocate_without_global_object<ConsoleGlobalObject>(static_cast<Web::Bindings::WindowObject&>(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));
// 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();
vm.pop_execution_context();
diff --git a/Ladybird/ConsoleGlobalObject.cpp b/Ladybird/ConsoleGlobalObject.cpp
index 3abb32d171..07ba5329f1 100644
--- a/Ladybird/ConsoleGlobalObject.cpp
+++ b/Ladybird/ConsoleGlobalObject.cpp
@@ -15,8 +15,9 @@
namespace Ladybird {
-ConsoleGlobalObject::ConsoleGlobalObject(Web::Bindings::WindowObject& parent_object)
- : m_window_object(&parent_object)
+ConsoleGlobalObject::ConsoleGlobalObject(JS::Realm& realm, Web::Bindings::WindowObject& parent_object)
+ : JS::GlobalObject(realm)
+ , m_window_object(&parent_object)
{
}
diff --git a/Ladybird/ConsoleGlobalObject.h b/Ladybird/ConsoleGlobalObject.h
index b289b4164f..2e50f951cf 100644
--- a/Ladybird/ConsoleGlobalObject.h
+++ b/Ladybird/ConsoleGlobalObject.h
@@ -23,7 +23,7 @@ class ConsoleGlobalObject final : public JS::GlobalObject {
JS_OBJECT(ConsoleGlobalObject, JS::GlobalObject);
public:
- ConsoleGlobalObject(Web::Bindings::WindowObject&);
+ ConsoleGlobalObject(JS::Realm&, Web::Bindings::WindowObject&);
virtual ~ConsoleGlobalObject() override = default;
virtual JS::ThrowCompletionOr<Object*> internal_get_prototype_of() const override;