From 61bd9fef7d14b32e24c0d4d7841e569068d37629 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sat, 27 Aug 2022 01:03:50 +0100 Subject: [PATCH] LibJS+LibWeb: Remove last uses of GlobalObject::associated_realm() --- Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp | 2 +- Userland/Libraries/LibWeb/Bindings/WindowObject.h | 4 ++-- Userland/Libraries/LibWeb/DOM/Document.cpp | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp index 0ea85b9cd7..0cf00befef 100644 --- a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp @@ -61,7 +61,7 @@ ECMAScriptFunctionObject::ECMAScriptFunctionObject(FlyString name, String source , m_private_environment(private_environment) , m_formal_parameters(move(formal_parameters)) , m_ecmascript_code(ecmascript_code) - , m_realm(global_object().associated_realm()) + , m_realm(&prototype.shape().realm()) , m_source_text(move(source_text)) , m_class_field_initializer_name(move(class_field_initializer_name)) , m_strict(strict) diff --git a/Userland/Libraries/LibWeb/Bindings/WindowObject.h b/Userland/Libraries/LibWeb/Bindings/WindowObject.h index d65673aa33..df346b8f44 100644 --- a/Userland/Libraries/LibWeb/Bindings/WindowObject.h +++ b/Userland/Libraries/LibWeb/Bindings/WindowObject.h @@ -53,7 +53,7 @@ public: auto it = m_prototypes.find(class_name); if (it != m_prototypes.end()) return *it->value; - auto& realm = *associated_realm(); + auto& realm = shape().realm(); auto* prototype = heap().allocate(realm, realm); m_prototypes.set(class_name, prototype); return *prototype; @@ -65,7 +65,7 @@ public: auto it = m_constructors.find(class_name); if (it != m_constructors.end()) return *it->value; - auto& realm = *associated_realm(); + auto& realm = shape().realm(); auto* constructor = heap().allocate(realm, realm); m_constructors.set(class_name, constructor); define_direct_property(class_name, JS::Value(constructor), JS::Attribute::Writable | JS::Attribute::Configurable); diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index f45b4af4f3..b80cd11415 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -1081,8 +1081,7 @@ JS::Realm& Document::realm() { VERIFY(m_window); VERIFY(m_window->wrapper()); - VERIFY(m_window->wrapper()->associated_realm()); - return *m_window->wrapper()->associated_realm(); + return m_window->wrapper()->shape().realm(); } JS::Interpreter& Document::interpreter()