1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:57:35 +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

@ -76,9 +76,9 @@ CanvasRenderingContext2DWrapper::~CanvasRenderingContext2DWrapper()
{
}
static CanvasRenderingContext2D* impl_from(JS::Interpreter& interpreter)
static CanvasRenderingContext2D* 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 a CanvasRenderingContext2DWrapper somehow!
@ -87,7 +87,7 @@ static CanvasRenderingContext2D* impl_from(JS::Interpreter& interpreter)
JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::fill_rect)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
if (interpreter.argument_count() >= 4) {
@ -110,7 +110,7 @@ JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::fill_rect)
JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::stroke_rect)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
if (interpreter.argument_count() >= 4) {
@ -133,12 +133,12 @@ JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::stroke_rect)
JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::draw_image)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
if (interpreter.argument_count() < 3)
return interpreter.throw_exception<JS::TypeError>(JS::ErrorType::DrawImageArgumentCount);
auto* image_argument = interpreter.argument(0).to_object(interpreter);
auto* image_argument = interpreter.argument(0).to_object(interpreter, global_object);
if (!image_argument)
return {};
if (StringView(image_argument->class_name()) != "HTMLImageElementWrapper")
@ -156,7 +156,7 @@ JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::draw_image)
JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::scale)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
if (interpreter.argument_count() >= 2) {
@ -174,7 +174,7 @@ JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::scale)
JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::translate)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
if (interpreter.argument_count() >= 2) {
@ -192,7 +192,7 @@ JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::translate)
JS_DEFINE_NATIVE_GETTER(CanvasRenderingContext2DWrapper::fill_style_getter)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
return JS::js_string(interpreter, impl->fill_style());
@ -200,7 +200,7 @@ JS_DEFINE_NATIVE_GETTER(CanvasRenderingContext2DWrapper::fill_style_getter)
JS_DEFINE_NATIVE_SETTER(CanvasRenderingContext2DWrapper::fill_style_setter)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return;
auto string = value.to_string(interpreter);
@ -211,7 +211,7 @@ JS_DEFINE_NATIVE_SETTER(CanvasRenderingContext2DWrapper::fill_style_setter)
JS_DEFINE_NATIVE_GETTER(CanvasRenderingContext2DWrapper::stroke_style_getter)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
return JS::js_string(interpreter, impl->stroke_style());
@ -219,7 +219,7 @@ JS_DEFINE_NATIVE_GETTER(CanvasRenderingContext2DWrapper::stroke_style_getter)
JS_DEFINE_NATIVE_SETTER(CanvasRenderingContext2DWrapper::stroke_style_setter)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return;
auto string = value.to_string(interpreter);
@ -230,7 +230,7 @@ JS_DEFINE_NATIVE_SETTER(CanvasRenderingContext2DWrapper::stroke_style_setter)
JS_DEFINE_NATIVE_GETTER(CanvasRenderingContext2DWrapper::line_width_getter)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
return JS::Value(impl->line_width());
@ -238,7 +238,7 @@ JS_DEFINE_NATIVE_GETTER(CanvasRenderingContext2DWrapper::line_width_getter)
JS_DEFINE_NATIVE_SETTER(CanvasRenderingContext2DWrapper::line_width_setter)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return;
auto line_width = value.to_double(interpreter);
@ -249,7 +249,7 @@ JS_DEFINE_NATIVE_SETTER(CanvasRenderingContext2DWrapper::line_width_setter)
JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::begin_path)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
impl->begin_path();
@ -258,7 +258,7 @@ JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::begin_path)
JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::close_path)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
impl->close_path();
@ -267,7 +267,7 @@ JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::close_path)
JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::stroke)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
impl->stroke();
@ -276,7 +276,7 @@ JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::stroke)
JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::fill)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
auto winding = Gfx::Painter::WindingRule::Nonzero;
@ -303,7 +303,7 @@ JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::fill)
JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::move_to)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
auto x = interpreter.argument(0).to_double(interpreter);
@ -318,7 +318,7 @@ JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::move_to)
JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::line_to)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
auto x = interpreter.argument(0).to_double(interpreter);
@ -333,7 +333,7 @@ JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::line_to)
JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::quadratic_curve_to)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
auto cx = interpreter.argument(0).to_double(interpreter);
@ -354,7 +354,7 @@ JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::quadratic_curve_to)
JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::create_image_data)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
auto width = interpreter.argument(0).to_i32(interpreter);
@ -369,11 +369,11 @@ JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::create_image_data)
JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::put_image_data)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
auto* image_data_object = interpreter.argument(0).to_object(interpreter);
auto* image_data_object = interpreter.argument(0).to_object(interpreter, global_object);
if (!image_data_object)
return {};
@ -394,7 +394,7 @@ JS_DEFINE_NATIVE_FUNCTION(CanvasRenderingContext2DWrapper::put_image_data)
JS_DEFINE_NATIVE_GETTER(CanvasRenderingContext2DWrapper::canvas_getter)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
auto* element = impl->element();

View file

@ -60,9 +60,9 @@ const Document& DocumentWrapper::node() const
return static_cast<const Document&>(NodeWrapper::node());
}
static Document* document_from(JS::Interpreter& interpreter)
static Document* 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 {};
if (StringView("DocumentWrapper") != this_object->class_name()) {
@ -74,7 +74,7 @@ static Document* document_from(JS::Interpreter& interpreter)
JS_DEFINE_NATIVE_FUNCTION(DocumentWrapper::get_element_by_id)
{
auto* document = document_from(interpreter);
auto* document = impl_from(interpreter, global_object);
if (!document)
return {};
if (!interpreter.argument_count())
@ -90,7 +90,7 @@ JS_DEFINE_NATIVE_FUNCTION(DocumentWrapper::get_element_by_id)
JS_DEFINE_NATIVE_FUNCTION(DocumentWrapper::query_selector)
{
auto* document = document_from(interpreter);
auto* document = impl_from(interpreter, global_object);
if (!document)
return {};
if (!interpreter.argument_count())
@ -107,7 +107,7 @@ JS_DEFINE_NATIVE_FUNCTION(DocumentWrapper::query_selector)
JS_DEFINE_NATIVE_FUNCTION(DocumentWrapper::query_selector_all)
{
auto* document = document_from(interpreter);
auto* document = impl_from(interpreter, global_object);
if (!document)
return {};
if (!interpreter.argument_count())

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;

View file

@ -51,7 +51,7 @@ EventTargetWrapper::~EventTargetWrapper()
JS_DEFINE_NATIVE_FUNCTION(EventTargetWrapper::add_event_listener)
{
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
if (!this_object)
return {};
if (interpreter.argument_count() < 2)

View file

@ -61,9 +61,9 @@ const HTMLCanvasElement& HTMLCanvasElementWrapper::node() const
return static_cast<const HTMLCanvasElement&>(NodeWrapper::node());
}
static HTMLCanvasElement* impl_from(JS::Interpreter& interpreter)
static HTMLCanvasElement* 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 a HTMLCanvasElementWrapper somehow!
@ -72,7 +72,7 @@ static HTMLCanvasElement* impl_from(JS::Interpreter& interpreter)
JS_DEFINE_NATIVE_FUNCTION(HTMLCanvasElementWrapper::get_context)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
auto context_type = interpreter.argument(0).to_string(interpreter);
@ -86,14 +86,14 @@ JS_DEFINE_NATIVE_FUNCTION(HTMLCanvasElementWrapper::get_context)
JS_DEFINE_NATIVE_GETTER(HTMLCanvasElementWrapper::width_getter)
{
if (auto* impl = impl_from(interpreter))
if (auto* impl = impl_from(interpreter, global_object))
return JS::Value(impl->requested_width());
return {};
}
JS_DEFINE_NATIVE_GETTER(HTMLCanvasElementWrapper::height_getter)
{
if (auto* impl = impl_from(interpreter))
if (auto* impl = impl_from(interpreter, global_object))
return JS::Value(impl->requested_height());
return {};
}

View file

@ -53,9 +53,9 @@ ImageDataWrapper::~ImageDataWrapper()
{
}
static ImageData* impl_from(JS::Interpreter& interpreter)
static ImageData* 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) {
ASSERT_NOT_REACHED();
return nullptr;
@ -69,7 +69,7 @@ static ImageData* impl_from(JS::Interpreter& interpreter)
JS_DEFINE_NATIVE_GETTER(ImageDataWrapper::width_getter)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
return JS::Value(impl->width());
@ -77,7 +77,7 @@ JS_DEFINE_NATIVE_GETTER(ImageDataWrapper::width_getter)
JS_DEFINE_NATIVE_GETTER(ImageDataWrapper::height_getter)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
return JS::Value(impl->height());
@ -85,7 +85,7 @@ JS_DEFINE_NATIVE_GETTER(ImageDataWrapper::height_getter)
JS_DEFINE_NATIVE_GETTER(ImageDataWrapper::data_getter)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
return impl->data();

View file

@ -56,9 +56,9 @@ MouseEvent& MouseEventWrapper::event()
return static_cast<MouseEvent&>(EventWrapper::event());
}
static MouseEvent* impl_from(JS::Interpreter& interpreter)
static MouseEvent* 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 a CanvasRenderingContext2DWrapper somehow!
@ -67,14 +67,14 @@ static MouseEvent* impl_from(JS::Interpreter& interpreter)
JS_DEFINE_NATIVE_GETTER(MouseEventWrapper::offset_x_getter)
{
if (auto* impl = impl_from(interpreter))
if (auto* impl = impl_from(interpreter, global_object))
return JS::Value(impl->offset_x());
return {};
}
JS_DEFINE_NATIVE_GETTER(MouseEventWrapper::offset_y_getter)
{
if (auto* impl = impl_from(interpreter))
if (auto* impl = impl_from(interpreter, global_object))
return JS::Value(impl->offset_y());
return {};
}

View file

@ -80,9 +80,9 @@ void WindowObject::visit_children(Visitor& visitor)
visitor.visit(m_xhr_prototype);
}
static Window* impl_from(JS::Interpreter& interpreter)
static Window* 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) {
ASSERT_NOT_REACHED();
return nullptr;
@ -96,7 +96,7 @@ static Window* impl_from(JS::Interpreter& interpreter)
JS_DEFINE_NATIVE_FUNCTION(WindowObject::alert)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
String message = "";
@ -111,7 +111,7 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::alert)
JS_DEFINE_NATIVE_FUNCTION(WindowObject::confirm)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
String message = "";
@ -125,12 +125,12 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::confirm)
JS_DEFINE_NATIVE_FUNCTION(WindowObject::set_interval)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
if (!interpreter.argument_count())
return interpreter.throw_exception<JS::TypeError>(JS::ErrorType::BadArgCountAtLeastOne, "setInterval");
auto* callback_object = interpreter.argument(0).to_object(interpreter);
auto* callback_object = interpreter.argument(0).to_object(interpreter, global_object);
if (!callback_object)
return {};
if (!callback_object->is_function())
@ -151,12 +151,12 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::set_interval)
JS_DEFINE_NATIVE_FUNCTION(WindowObject::set_timeout)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
if (!interpreter.argument_count())
return interpreter.throw_exception<JS::TypeError>(JS::ErrorType::BadArgCountAtLeastOne, "setTimeout");
auto* callback_object = interpreter.argument(0).to_object(interpreter);
auto* callback_object = interpreter.argument(0).to_object(interpreter, global_object);
if (!callback_object)
return {};
if (!callback_object->is_function())
@ -177,12 +177,12 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::set_timeout)
JS_DEFINE_NATIVE_FUNCTION(WindowObject::request_animation_frame)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
if (!interpreter.argument_count())
return interpreter.throw_exception<JS::TypeError>(JS::ErrorType::BadArgCountOne, "requestAnimationFrame");
auto* callback_object = interpreter.argument(0).to_object(interpreter);
auto* callback_object = interpreter.argument(0).to_object(interpreter, global_object);
if (!callback_object)
return {};
if (!callback_object->is_function())
@ -192,7 +192,7 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::request_animation_frame)
JS_DEFINE_NATIVE_FUNCTION(WindowObject::cancel_animation_frame)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
if (!interpreter.argument_count())
@ -206,7 +206,7 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::cancel_animation_frame)
JS_DEFINE_NATIVE_GETTER(WindowObject::document_getter)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
return wrap(interpreter.heap(), impl->document());

View file

@ -58,9 +58,9 @@ XMLHttpRequestPrototype::~XMLHttpRequestPrototype()
{
}
static XMLHttpRequest* impl_from(JS::Interpreter& interpreter)
static XMLHttpRequest* 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;
if (StringView("XMLHttpRequestWrapper") != this_object->class_name()) {
@ -72,7 +72,7 @@ static XMLHttpRequest* impl_from(JS::Interpreter& interpreter)
JS_DEFINE_NATIVE_FUNCTION(XMLHttpRequestPrototype::open)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
auto arg0 = interpreter.argument(0).to_string(interpreter);
@ -87,7 +87,7 @@ JS_DEFINE_NATIVE_FUNCTION(XMLHttpRequestPrototype::open)
JS_DEFINE_NATIVE_FUNCTION(XMLHttpRequestPrototype::send)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
impl->send();
@ -96,7 +96,7 @@ JS_DEFINE_NATIVE_FUNCTION(XMLHttpRequestPrototype::send)
JS_DEFINE_NATIVE_GETTER(XMLHttpRequestPrototype::ready_state_getter)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
return JS::Value((i32)impl->ready_state());
@ -104,7 +104,7 @@ JS_DEFINE_NATIVE_GETTER(XMLHttpRequestPrototype::ready_state_getter)
JS_DEFINE_NATIVE_GETTER(XMLHttpRequestPrototype::response_text_getter)
{
auto* impl = impl_from(interpreter);
auto* impl = impl_from(interpreter, global_object);
if (!impl)
return {};
return JS::js_string(interpreter, impl->response_text());