Selaa lähdekoodia

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

Linus Groh 2 vuotta sitten
vanhempi
commit
61bd9fef7d

+ 1 - 1
Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp

@@ -61,7 +61,7 @@ ECMAScriptFunctionObject::ECMAScriptFunctionObject(FlyString name, String source
     , m_private_environment(private_environment)
     , m_private_environment(private_environment)
     , m_formal_parameters(move(formal_parameters))
     , m_formal_parameters(move(formal_parameters))
     , m_ecmascript_code(ecmascript_code)
     , m_ecmascript_code(ecmascript_code)
-    , m_realm(global_object().associated_realm())
+    , m_realm(&prototype.shape().realm())
     , m_source_text(move(source_text))
     , m_source_text(move(source_text))
     , m_class_field_initializer_name(move(class_field_initializer_name))
     , m_class_field_initializer_name(move(class_field_initializer_name))
     , m_strict(strict)
     , m_strict(strict)

+ 2 - 2
Userland/Libraries/LibWeb/Bindings/WindowObject.h

@@ -53,7 +53,7 @@ public:
         auto it = m_prototypes.find(class_name);
         auto it = m_prototypes.find(class_name);
         if (it != m_prototypes.end())
         if (it != m_prototypes.end())
             return *it->value;
             return *it->value;
-        auto& realm = *associated_realm();
+        auto& realm = shape().realm();
         auto* prototype = heap().allocate<T>(realm, realm);
         auto* prototype = heap().allocate<T>(realm, realm);
         m_prototypes.set(class_name, prototype);
         m_prototypes.set(class_name, prototype);
         return *prototype;
         return *prototype;
@@ -65,7 +65,7 @@ public:
         auto it = m_constructors.find(class_name);
         auto it = m_constructors.find(class_name);
         if (it != m_constructors.end())
         if (it != m_constructors.end())
             return *it->value;
             return *it->value;
-        auto& realm = *associated_realm();
+        auto& realm = shape().realm();
         auto* constructor = heap().allocate<T>(realm, realm);
         auto* constructor = heap().allocate<T>(realm, realm);
         m_constructors.set(class_name, constructor);
         m_constructors.set(class_name, constructor);
         define_direct_property(class_name, JS::Value(constructor), JS::Attribute::Writable | JS::Attribute::Configurable);
         define_direct_property(class_name, JS::Value(constructor), JS::Attribute::Writable | JS::Attribute::Configurable);

+ 1 - 2
Userland/Libraries/LibWeb/DOM/Document.cpp

@@ -1081,8 +1081,7 @@ JS::Realm& Document::realm()
 {
 {
     VERIFY(m_window);
     VERIFY(m_window);
     VERIFY(m_window->wrapper());
     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()
 JS::Interpreter& Document::interpreter()