1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 21:37:34 +00:00

LibJS: NativeProperty get/put should take a GlobalObject&

This commit is contained in:
Andreas Kling 2020-06-20 17:35:25 +02:00
parent 03da70c7d0
commit e1f9da142e
3 changed files with 8 additions and 8 deletions

View file

@ -40,18 +40,18 @@ NativeProperty::~NativeProperty()
{
}
Value NativeProperty::get(Interpreter& interpreter) const
Value NativeProperty::get(Interpreter& interpreter, GlobalObject& global_object) const
{
if (!m_getter)
return js_undefined();
return m_getter(interpreter, global_object());
return m_getter(interpreter, global_object);
}
void NativeProperty::set(Interpreter& interpreter, Value value)
void NativeProperty::set(Interpreter& interpreter, GlobalObject& global_object, Value value)
{
if (!m_setter)
return;
m_setter(interpreter, global_object(), move(value));
m_setter(interpreter, global_object, move(value));
}
}

View file

@ -36,8 +36,8 @@ public:
NativeProperty(AK::Function<Value(Interpreter&, GlobalObject&)> getter, AK::Function<void(Interpreter&, GlobalObject&, Value)> setter);
virtual ~NativeProperty() override;
Value get(Interpreter&) const;
void set(Interpreter&, Value);
Value get(Interpreter&, GlobalObject&) const;
void set(Interpreter&, GlobalObject&, Value);
private:
virtual bool is_native_property() const override { return true; }

View file

@ -808,7 +808,7 @@ Value Object::call_native_property_getter(Object* this_object, Value property) c
auto& native_property = static_cast<NativeProperty&>(property.as_object());
auto& call_frame = interpreter().push_call_frame();
call_frame.this_value = this_object;
auto result = native_property.get(interpreter());
auto result = native_property.get(interpreter(), global_object());
interpreter().pop_call_frame();
return result;
}
@ -820,7 +820,7 @@ void Object::call_native_property_setter(Object* this_object, Value property, Va
auto& native_property = static_cast<NativeProperty&>(property.as_object());
auto& call_frame = interpreter().push_call_frame();
call_frame.this_value = this_object;
native_property.set(interpreter(), value);
native_property.set(interpreter(), global_object(), value);
interpreter().pop_call_frame();
}