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

LibJS: Make Value::to_object() take a GlobalObject&

This commit is contained in:
Andreas Kling 2020-06-20 16:40:30 +02:00
parent cd14ebb11f
commit 8d56e6103e
28 changed files with 129 additions and 129 deletions

View file

@ -63,9 +63,9 @@ const Element& ElementWrapper::node() const
return static_cast<const Element&>(NodeWrapper::node());
}
static Element* impl_from(JS::Interpreter& interpreter)
static Element* impl_from(JS::Interpreter& interpreter, JS::GlobalObject& global_object)
{
auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
if (!this_object)
return nullptr;
// FIXME: Verify that it's an ElementWrapper somehow!
@ -74,7 +74,7 @@ static Element* impl_from(JS::Interpreter& interpreter)
JS_DEFINE_NATIVE_FUNCTION(ElementWrapper::get_attribute)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
@ -94,7 +94,7 @@ JS_DEFINE_NATIVE_FUNCTION(ElementWrapper::get_attribute)
JS_DEFINE_NATIVE_FUNCTION(ElementWrapper::set_attribute)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
@ -115,14 +115,14 @@ JS_DEFINE_NATIVE_FUNCTION(ElementWrapper::set_attribute)
JS_DEFINE_NATIVE_GETTER(ElementWrapper::inner_html_getter)
{
if (auto* impl = impl_from(interpreter))
if (auto* impl = impl_from(interpreter, global_object))
return JS::js_string(interpreter, impl->inner_html());
return {};
}
JS_DEFINE_NATIVE_SETTER(ElementWrapper::inner_html_setter)
{
if (auto* impl = impl_from(interpreter)) {
if (auto* impl = impl_from(interpreter, global_object)) {
auto string = value.to_string(interpreter);
if (interpreter.exception())
return;
@ -132,14 +132,14 @@ JS_DEFINE_NATIVE_SETTER(ElementWrapper::inner_html_setter)
JS_DEFINE_NATIVE_GETTER(ElementWrapper::id_getter)
{
if (auto* impl = impl_from(interpreter))
if (auto* impl = impl_from(interpreter, global_object))
return JS::js_string(interpreter, impl->attribute(HTML::AttributeNames::id));
return {};
}
JS_DEFINE_NATIVE_SETTER(ElementWrapper::id_setter)
{
if (auto* impl = impl_from(interpreter)) {
if (auto* impl = impl_from(interpreter, global_object)) {
auto string = value.to_string(interpreter);
if (interpreter.exception())
return;