diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp index 83d1bac957..602a4f64fa 100644 --- a/Libraries/LibJS/AST.cpp +++ b/Libraries/LibJS/AST.cpp @@ -1372,7 +1372,7 @@ Value ObjectExpression::execute(Interpreter& interpreter, GlobalObject& global_o accessor = &existing_property.as_accessor(); } if (!accessor) { - accessor = Accessor::create(interpreter, nullptr, nullptr); + accessor = Accessor::create(interpreter, global_object, nullptr, nullptr); object->define_property(key, accessor, Attribute::Configurable | Attribute::Enumerable); if (interpreter.exception()) return {}; diff --git a/Libraries/LibJS/Runtime/Accessor.h b/Libraries/LibJS/Runtime/Accessor.h index 0bbf945914..5978cf7664 100644 --- a/Libraries/LibJS/Runtime/Accessor.h +++ b/Libraries/LibJS/Runtime/Accessor.h @@ -35,9 +35,9 @@ namespace JS { class Accessor final : public Cell { public: - static Accessor* create(Interpreter& interpreter, Function* getter, Function* setter) + static Accessor* create(Interpreter& interpreter, GlobalObject& global_object, Function* getter, Function* setter) { - return interpreter.heap().allocate(interpreter.global_object(), getter, setter); + return interpreter.heap().allocate(global_object, getter, setter); } Accessor(Function* getter, Function* setter) diff --git a/Libraries/LibJS/Runtime/Object.cpp b/Libraries/LibJS/Runtime/Object.cpp index 544de42add..72c5dc8e6f 100644 --- a/Libraries/LibJS/Runtime/Object.cpp +++ b/Libraries/LibJS/Runtime/Object.cpp @@ -388,7 +388,7 @@ bool Object::define_property(const FlyString& property_name, const Object& descr << "getter=" << getter.to_string_without_side_effects() << ", " << "setter=" << setter.to_string_without_side_effects() << "}"; - return define_property(property_name, Accessor::create(interpreter(), getter_function, setter_function), attributes, throw_exceptions); + return define_property(property_name, Accessor::create(interpreter(), global_object(), getter_function, setter_function), attributes, throw_exceptions); } auto value = descriptor.get("value");