1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:47:35 +00:00

LibJS: Interpreter::this_value() => this_value(GlobalObject&)

Once the Interpreter has no global object attached to it, we have to
provide it everywhere.
This commit is contained in:
Andreas Kling 2020-06-08 21:10:22 +02:00
parent 25f2a29d84
commit 053863f35e
25 changed files with 78 additions and 73 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);
auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
if (!this_object)
return nullptr;
// FIXME: Verify that it's a CanvasRenderingContext2DWrapper somehow!

View file

@ -28,6 +28,7 @@
#include <LibJS/Interpreter.h>
#include <LibJS/Runtime/Array.h>
#include <LibJS/Runtime/Error.h>
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/PrimitiveString.h>
#include <LibJS/Runtime/Value.h>
#include <LibWeb/Bindings/DocumentWrapper.h>
@ -61,7 +62,7 @@ const Document& DocumentWrapper::node() const
static Document* document_from(JS::Interpreter& interpreter)
{
auto* this_object = interpreter.this_value().to_object(interpreter);
auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
if (!this_object)
return {};
if (StringView("DocumentWrapper") != this_object->class_name()) {

View file

@ -28,6 +28,7 @@
#include <AK/Function.h>
#include <LibJS/Interpreter.h>
#include <LibJS/Runtime/Error.h>
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/PrimitiveString.h>
#include <LibJS/Runtime/Value.h>
#include <LibWeb/Bindings/ElementWrapper.h>
@ -64,7 +65,7 @@ const Element& ElementWrapper::node() const
static Element* impl_from(JS::Interpreter& interpreter)
{
auto* this_object = interpreter.this_value().to_object(interpreter);
auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
if (!this_object)
return nullptr;
// FIXME: Verify that it's an ElementWrapper somehow!

View file

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

View file

@ -27,6 +27,7 @@
#include <AK/FlyString.h>
#include <AK/Function.h>
#include <LibJS/Interpreter.h>
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/PrimitiveString.h>
#include <LibJS/Runtime/Value.h>
#include <LibWeb/Bindings/CanvasRenderingContext2DWrapper.h>
@ -62,7 +63,7 @@ const HTMLCanvasElement& HTMLCanvasElementWrapper::node() const
static HTMLCanvasElement* impl_from(JS::Interpreter& interpreter)
{
auto* this_object = interpreter.this_value().to_object(interpreter);
auto* this_object = interpreter.this_value(interpreter.global_object()).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);
auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
if (!this_object) {
ASSERT_NOT_REACHED();
return nullptr;

View file

@ -28,6 +28,7 @@
#include <AK/Function.h>
#include <LibJS/Interpreter.h>
#include <LibJS/Runtime/Function.h>
#include <LibJS/Runtime/GlobalObject.h>
#include <LibWeb/Bindings/MouseEventWrapper.h>
#include <LibWeb/DOM/MouseEvent.h>
@ -57,7 +58,7 @@ MouseEvent& MouseEventWrapper::event()
static MouseEvent* impl_from(JS::Interpreter& interpreter)
{
auto* this_object = interpreter.this_value().to_object(interpreter);
auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
if (!this_object)
return nullptr;
// FIXME: Verify that it's a CanvasRenderingContext2DWrapper somehow!

View file

@ -82,7 +82,7 @@ void WindowObject::visit_children(Visitor& visitor)
static Window* impl_from(JS::Interpreter& interpreter)
{
auto* this_object = interpreter.this_value().to_object(interpreter);
auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
if (!this_object) {
ASSERT_NOT_REACHED();
return nullptr;

View file

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