1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:57:43 +00:00

LibJS: Change Value::to_object(Heap& -> Interpreter&)

Passing a Heap& to it only to then call interpreter() on that is weird.
Let's just give it the Interpreter& directly, like some of the other
to_something() functions.
This commit is contained in:
Linus Groh 2020-05-17 21:38:47 +01:00 committed by Andreas Kling
parent b8b7f84547
commit 1a1394f7a2
26 changed files with 56 additions and 57 deletions

View file

@ -78,7 +78,7 @@ CanvasRenderingContext2DWrapper::~CanvasRenderingContext2DWrapper()
static CanvasRenderingContext2D* impl_from(JS::Interpreter& interpreter)
{
auto* this_object = interpreter.this_value().to_object(interpreter.heap());
auto* this_object = interpreter.this_value().to_object(interpreter);
if (!this_object)
return nullptr;
// FIXME: Verify that it's a CanvasRenderingContext2DWrapper somehow!
@ -116,7 +116,7 @@ JS::Value CanvasRenderingContext2DWrapper::draw_image(JS::Interpreter& interpret
if (arguments.size() < 3)
return interpreter.throw_exception<JS::TypeError>("drawImage() needs more arguments");
auto* image_argument = arguments[0].to_object(interpreter.heap());
auto* image_argument = arguments[0].to_object(interpreter);
if (!image_argument)
return {};
if (StringView(image_argument->class_name()) != "HTMLImageElementWrapper")
@ -307,7 +307,7 @@ JS::Value CanvasRenderingContext2DWrapper::put_image_data(JS::Interpreter& inter
if (!impl)
return {};
auto* image_data_object = interpreter.argument(0).to_object(interpreter.heap());
auto* image_data_object = interpreter.argument(0).to_object(interpreter);
if (!image_data_object)
return {};

View file

@ -60,7 +60,7 @@ const Document& DocumentWrapper::node() const
static Document* document_from(JS::Interpreter& interpreter)
{
auto* this_object = interpreter.this_value().to_object(interpreter.heap());
auto* this_object = interpreter.this_value().to_object(interpreter);
if (!this_object)
return {};
if (StringView("DocumentWrapper") != this_object->class_name()) {

View file

@ -58,7 +58,7 @@ const Element& ElementWrapper::node() const
static Element* impl_from(JS::Interpreter& interpreter)
{
auto* this_object = interpreter.this_value().to_object(interpreter.heap());
auto* this_object = interpreter.this_value().to_object(interpreter);
if (!this_object)
return nullptr;
// FIXME: Verify that it's an ElementWrapper somehow!

View file

@ -50,7 +50,7 @@ EventTargetWrapper::~EventTargetWrapper()
JS::Value EventTargetWrapper::add_event_listener(JS::Interpreter& interpreter)
{
auto* this_object = interpreter.this_value().to_object(interpreter.heap());
auto* this_object = interpreter.this_value().to_object(interpreter);
if (!this_object)
return {};
auto& arguments = interpreter.call_frame().arguments;

View file

@ -62,7 +62,7 @@ const HTMLCanvasElement& HTMLCanvasElementWrapper::node() const
static HTMLCanvasElement* impl_from(JS::Interpreter& interpreter)
{
auto* this_object = interpreter.this_value().to_object(interpreter.heap());
auto* this_object = interpreter.this_value().to_object(interpreter);
if (!this_object)
return nullptr;
// FIXME: Verify that it's a HTMLCanvasElementWrapper somehow!

View file

@ -55,7 +55,7 @@ ImageDataWrapper::~ImageDataWrapper()
static ImageData* impl_from(JS::Interpreter& interpreter)
{
auto* this_object = interpreter.this_value().to_object(interpreter.heap());
auto* this_object = interpreter.this_value().to_object(interpreter);
if (!this_object) {
ASSERT_NOT_REACHED();
return nullptr;

View file

@ -57,7 +57,7 @@ MouseEvent& MouseEventWrapper::event()
static MouseEvent* impl_from(JS::Interpreter& interpreter)
{
auto* this_object = interpreter.this_value().to_object(interpreter.heap());
auto* this_object = interpreter.this_value().to_object(interpreter);
if (!this_object)
return nullptr;
// FIXME: Verify that it's a CanvasRenderingContext2DWrapper somehow!

View file

@ -80,7 +80,7 @@ void WindowObject::visit_children(Visitor& visitor)
static Window* impl_from(JS::Interpreter& interpreter)
{
auto* this_object = interpreter.this_value().to_object(interpreter.heap());
auto* this_object = interpreter.this_value().to_object(interpreter);
if (!this_object) {
ASSERT_NOT_REACHED();
return nullptr;
@ -129,7 +129,7 @@ JS::Value WindowObject::set_interval(JS::Interpreter& interpreter)
auto& arguments = interpreter.call_frame().arguments;
if (arguments.size() < 2)
return {};
auto* callback_object = arguments[0].to_object(interpreter.heap());
auto* callback_object = arguments[0].to_object(interpreter);
if (!callback_object)
return {};
if (!callback_object->is_function())
@ -146,7 +146,7 @@ JS::Value WindowObject::set_timeout(JS::Interpreter& interpreter)
auto& arguments = interpreter.call_frame().arguments;
if (arguments.size() < 1)
return {};
auto* callback_object = arguments[0].to_object(interpreter.heap());
auto* callback_object = arguments[0].to_object(interpreter);
if (!callback_object)
return {};
if (!callback_object->is_function())
@ -168,7 +168,7 @@ JS::Value WindowObject::request_animation_frame(JS::Interpreter& interpreter)
auto& arguments = interpreter.call_frame().arguments;
if (arguments.size() < 1)
return {};
auto* callback_object = arguments[0].to_object(interpreter.heap());
auto* callback_object = arguments[0].to_object(interpreter);
if (!callback_object)
return {};
if (!callback_object->is_function())

View file

@ -56,7 +56,7 @@ XMLHttpRequestPrototype::~XMLHttpRequestPrototype()
static XMLHttpRequest* impl_from(JS::Interpreter& interpreter)
{
auto* this_object = interpreter.this_value().to_object(interpreter.heap());
auto* this_object = interpreter.this_value().to_object(interpreter);
if (!this_object)
return nullptr;
if (StringView("XMLHttpRequestWrapper") != this_object->class_name()) {