1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:18:11 +00:00

LibJS+LibWeb: Remove last uses of GlobalObject::associated_realm()

This commit is contained in:
Linus Groh 2022-08-27 01:03:50 +01:00
parent 50428ea8d2
commit 61bd9fef7d
3 changed files with 4 additions and 5 deletions

View file

@ -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)

View file

@ -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<T>(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<T>(realm, realm);
m_constructors.set(class_name, constructor);
define_direct_property(class_name, JS::Value(constructor), JS::Attribute::Writable | JS::Attribute::Configurable);

View file

@ -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()