summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-06-20 16:40:30 +0200
committerAndreas Kling <kling@serenityos.org>2020-06-20 17:50:48 +0200
commit8d56e6103e3e0a461e69dcb36aecb19f75731a5f (patch)
tree756eb4ad85e273b17ef385886d5540cdc52fa543 /Libraries
parentcd14ebb11f9875b3b1768727a558c8ddbe26eba4 (diff)
downloadserenity-8d56e6103e3e0a461e69dcb36aecb19f75731a5f.zip
LibJS: Make Value::to_object() take a GlobalObject&
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibJS/AST.cpp8
-rw-r--r--Libraries/LibJS/Runtime/Array.cpp2
-rw-r--r--Libraries/LibJS/Runtime/ArrayPrototype.cpp30
-rw-r--r--Libraries/LibJS/Runtime/BigIntPrototype.cpp2
-rw-r--r--Libraries/LibJS/Runtime/DatePrototype.cpp2
-rw-r--r--Libraries/LibJS/Runtime/ErrorPrototype.cpp6
-rw-r--r--Libraries/LibJS/Runtime/Function.cpp2
-rw-r--r--Libraries/LibJS/Runtime/FunctionPrototype.cpp8
-rw-r--r--Libraries/LibJS/Runtime/ObjectConstructor.cpp14
-rw-r--r--Libraries/LibJS/Runtime/ObjectPrototype.cpp8
-rw-r--r--Libraries/LibJS/Runtime/Reference.cpp4
-rw-r--r--Libraries/LibJS/Runtime/ScriptFunction.cpp2
-rw-r--r--Libraries/LibJS/Runtime/StringConstructor.cpp4
-rw-r--r--Libraries/LibJS/Runtime/StringPrototype.cpp4
-rw-r--r--Libraries/LibJS/Runtime/SymbolPrototype.cpp2
-rw-r--r--Libraries/LibJS/Runtime/Uint8ClampedArray.cpp2
-rw-r--r--Libraries/LibJS/Runtime/Value.cpp12
-rw-r--r--Libraries/LibJS/Runtime/Value.h2
-rw-r--r--Libraries/LibWeb/Bindings/CanvasRenderingContext2DWrapper.cpp50
-rw-r--r--Libraries/LibWeb/Bindings/DocumentWrapper.cpp10
-rw-r--r--Libraries/LibWeb/Bindings/ElementWrapper.cpp16
-rw-r--r--Libraries/LibWeb/Bindings/EventTargetWrapper.cpp2
-rw-r--r--Libraries/LibWeb/Bindings/HTMLCanvasElementWrapper.cpp10
-rw-r--r--Libraries/LibWeb/Bindings/ImageDataWrapper.cpp10
-rw-r--r--Libraries/LibWeb/Bindings/MouseEventWrapper.cpp8
-rw-r--r--Libraries/LibWeb/Bindings/WindowObject.cpp24
-rw-r--r--Libraries/LibWeb/Bindings/XMLHttpRequestPrototype.cpp12
27 files changed, 128 insertions, 128 deletions
diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp
index 602a4f64fa..27d3c8cb9d 100644
--- a/Libraries/LibJS/AST.cpp
+++ b/Libraries/LibJS/AST.cpp
@@ -97,7 +97,7 @@ CallExpression::ThisAndCallee CallExpression::compute_this_and_callee(Interprete
auto object_value = member_expression.object().execute(interpreter, global_object);
if (interpreter.exception())
return {};
- auto* this_value = object_value.to_object(interpreter);
+ auto* this_value = object_value.to_object(interpreter, global_object);
if (interpreter.exception())
return {};
auto callee = this_value->get(member_expression.computed_property_name(interpreter, global_object)).value_or(js_undefined());
@@ -365,7 +365,7 @@ Value ForInStatement::execute(Interpreter& interpreter, GlobalObject& global_obj
auto rhs_result = m_rhs->execute(interpreter, global_object);
if (interpreter.exception())
return {};
- auto* object = rhs_result.to_object(interpreter);
+ auto* object = rhs_result.to_object(interpreter, global_object);
while (object) {
auto property_names = object->get_own_properties(*object, Object::GetOwnPropertyMode::Key, true);
for (auto& property_name : property_names.as_object().indexed_properties()) {
@@ -587,7 +587,7 @@ Value UnaryExpression::execute(Interpreter& interpreter, GlobalObject& global_ob
ASSERT(!reference.is_local_variable());
if (reference.is_global_variable())
return global_object.delete_property(reference.name());
- auto* base_object = reference.base().to_object(interpreter);
+ auto* base_object = reference.base().to_object(interpreter, global_object);
if (!base_object)
return {};
return base_object->delete_property(reference.name());
@@ -1435,7 +1435,7 @@ Value MemberExpression::execute(Interpreter& interpreter, GlobalObject& global_o
auto object_value = m_object->execute(interpreter, global_object);
if (interpreter.exception())
return {};
- auto* object_result = object_value.to_object(interpreter);
+ auto* object_result = object_value.to_object(interpreter, global_object);
if (interpreter.exception())
return {};
return object_result->get(computed_property_name(interpreter, global_object)).value_or(js_undefined());
diff --git a/Libraries/LibJS/Runtime/Array.cpp b/Libraries/LibJS/Runtime/Array.cpp
index 7efe39e23d..9cb68a1b47 100644
--- a/Libraries/LibJS/Runtime/Array.cpp
+++ b/Libraries/LibJS/Runtime/Array.cpp
@@ -51,7 +51,7 @@ Array::~Array()
Array* Array::typed_this(Interpreter& interpreter, GlobalObject& global_object)
{
- 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 (!this_object->is_array()) {
diff --git a/Libraries/LibJS/Runtime/ArrayPrototype.cpp b/Libraries/LibJS/Runtime/ArrayPrototype.cpp
index 4b8d4b1396..08d7a49a69 100644
--- a/Libraries/LibJS/Runtime/ArrayPrototype.cpp
+++ b/Libraries/LibJS/Runtime/ArrayPrototype.cpp
@@ -105,7 +105,7 @@ static size_t get_length(Interpreter& interpreter, Object& object)
static void for_each_item(Interpreter& interpreter, GlobalObject& global_object, const String& name, AK::Function<IterationDecision(size_t index, Value value, Value callback_result)> callback, bool skip_empty = true)
{
- 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;
@@ -164,7 +164,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::for_each)
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::map)
{
- 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 {};
auto initial_length = get_length(interpreter, *this_object);
@@ -183,7 +183,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::map)
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::push)
{
- 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 (this_object->is_array()) {
@@ -223,7 +223,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::unshift)
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::pop)
{
- 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 (this_object->is_array()) {
@@ -265,7 +265,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::shift)
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::to_string)
{
- 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 {};
auto join_function = this_object->get("join");
@@ -278,7 +278,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::to_string)
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::to_locale_string)
{
- 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 {};
String separator = ","; // NOTE: This is implementation-specific.
@@ -294,7 +294,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::to_locale_string)
return {};
if (value.is_undefined() || value.is_null())
continue;
- auto* value_object = value.to_object(interpreter);
+ auto* value_object = value.to_object(interpreter, global_object);
ASSERT(value_object);
auto locale_string_result = value_object->invoke("toLocaleString");
if (interpreter.exception())
@@ -309,7 +309,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::to_locale_string)
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::join)
{
- 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 {};
String separator = ",";
@@ -411,7 +411,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::slice)
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::index_of)
{
- 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 {};
i32 length = get_length(interpreter, *this_object);
@@ -442,7 +442,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::index_of)
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reduce)
{
- 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 {};
@@ -501,7 +501,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reduce)
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reduce_right)
{
- 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 {};
@@ -584,7 +584,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reverse)
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::last_index_of)
{
- 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 {};
i32 length = get_length(interpreter, *this_object);
@@ -615,7 +615,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::last_index_of)
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::includes)
{
- 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 {};
i32 length = get_length(interpreter, *this_object);
@@ -702,7 +702,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::every)
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::splice)
{
- 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 {};
@@ -805,7 +805,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::splice)
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::fill)
{
- 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 {};
diff --git a/Libraries/LibJS/Runtime/BigIntPrototype.cpp b/Libraries/LibJS/Runtime/BigIntPrototype.cpp
index 483d5a46ee..c0bafbf1ba 100644
--- a/Libraries/LibJS/Runtime/BigIntPrototype.cpp
+++ b/Libraries/LibJS/Runtime/BigIntPrototype.cpp
@@ -51,7 +51,7 @@ BigIntPrototype::~BigIntPrototype()
static BigIntObject* bigint_object_from(Interpreter& interpreter, GlobalObject& global_object)
{
- 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 nullptr;
if (!this_object->is_bigint_object()) {
diff --git a/Libraries/LibJS/Runtime/DatePrototype.cpp b/Libraries/LibJS/Runtime/DatePrototype.cpp
index a762245947..1032ae44b4 100644
--- a/Libraries/LibJS/Runtime/DatePrototype.cpp
+++ b/Libraries/LibJS/Runtime/DatePrototype.cpp
@@ -38,7 +38,7 @@ namespace JS {
static Date* typed_this(Interpreter& interpreter, GlobalObject& global_object)
{
- 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 nullptr;
if (!this_object->is_date()) {
diff --git a/Libraries/LibJS/Runtime/ErrorPrototype.cpp b/Libraries/LibJS/Runtime/ErrorPrototype.cpp
index 4e5098b046..26e43dc6ed 100644
--- a/Libraries/LibJS/Runtime/ErrorPrototype.cpp
+++ b/Libraries/LibJS/Runtime/ErrorPrototype.cpp
@@ -54,7 +54,7 @@ ErrorPrototype::~ErrorPrototype()
JS_DEFINE_NATIVE_GETTER(ErrorPrototype::name_getter)
{
- 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 (!this_object->is_error())
@@ -64,7 +64,7 @@ JS_DEFINE_NATIVE_GETTER(ErrorPrototype::name_getter)
JS_DEFINE_NATIVE_SETTER(ErrorPrototype::name_setter)
{
- 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 (!this_object->is_error()) {
@@ -79,7 +79,7 @@ JS_DEFINE_NATIVE_SETTER(ErrorPrototype::name_setter)
JS_DEFINE_NATIVE_GETTER(ErrorPrototype::message_getter)
{
- 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 (!this_object->is_error())
diff --git a/Libraries/LibJS/Runtime/Function.cpp b/Libraries/LibJS/Runtime/Function.cpp
index 7585f9a4a1..329386cedd 100644
--- a/Libraries/LibJS/Runtime/Function.cpp
+++ b/Libraries/LibJS/Runtime/Function.cpp
@@ -61,7 +61,7 @@ BoundFunction* Function::bind(Value bound_this_value, Vector<Value> arguments)
return bound_this_value;
return &global_object();
default:
- return bound_this_value.to_object(interpreter());
+ return bound_this_value.to_object(interpreter(), global_object());
}
}();
diff --git a/Libraries/LibJS/Runtime/FunctionPrototype.cpp b/Libraries/LibJS/Runtime/FunctionPrototype.cpp
index f82236bcaa..97f51bc07c 100644
--- a/Libraries/LibJS/Runtime/FunctionPrototype.cpp
+++ b/Libraries/LibJS/Runtime/FunctionPrototype.cpp
@@ -60,7 +60,7 @@ FunctionPrototype::~FunctionPrototype()
JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::apply)
{
- 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 (!this_object->is_function())
@@ -90,7 +90,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::apply)
JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::bind)
{
- 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 (!this_object->is_function())
@@ -110,7 +110,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::bind)
JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::call)
{
- 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 (!this_object->is_function())
@@ -127,7 +127,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::call)
JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::to_string)
{
- 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 (!this_object->is_function())
diff --git a/Libraries/LibJS/Runtime/ObjectConstructor.cpp b/Libraries/LibJS/Runtime/ObjectConstructor.cpp
index 1de7f1c01a..d9e0cb01fe 100644
--- a/Libraries/LibJS/Runtime/ObjectConstructor.cpp
+++ b/Libraries/LibJS/Runtime/ObjectConstructor.cpp
@@ -77,7 +77,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_own_property_names)
{
if (!interpreter.argument_count())
return {};
- auto* object = interpreter.argument(0).to_object(interpreter);
+ auto* object = interpreter.argument(0).to_object(interpreter, global_object);
if (interpreter.exception())
return {};
auto* result = Array::create(global_object);
@@ -93,7 +93,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_prototype_of)
{
if (!interpreter.argument_count())
return {};
- auto* object = interpreter.argument(0).to_object(interpreter);
+ auto* object = interpreter.argument(0).to_object(interpreter, global_object);
if (interpreter.exception())
return {};
return object->prototype();
@@ -103,7 +103,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::set_prototype_of)
{
if (interpreter.argument_count() < 2)
return interpreter.throw_exception<TypeError>(ErrorType::ObjectSetPrototypeOfTwoArgs);
- auto* object = interpreter.argument(0).to_object(interpreter);
+ auto* object = interpreter.argument(0).to_object(interpreter, global_object);
if (interpreter.exception())
return {};
auto prototype_value = interpreter.argument(1);
@@ -147,7 +147,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::prevent_extensions)
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_own_property_descriptor)
{
- auto* object = interpreter.argument(0).to_object(interpreter);
+ auto* object = interpreter.argument(0).to_object(interpreter, global_object);
if (interpreter.exception())
return {};
auto property_key = interpreter.argument(1).to_string(interpreter);
@@ -190,7 +190,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::keys)
if (!interpreter.argument_count())
return interpreter.throw_exception<TypeError>(ErrorType::ConvertUndefinedToObject);
- auto* obj_arg = interpreter.argument(0).to_object(interpreter);
+ auto* obj_arg = interpreter.argument(0).to_object(interpreter, global_object);
if (interpreter.exception())
return {};
@@ -202,7 +202,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::values)
if (!interpreter.argument_count())
return interpreter.throw_exception<TypeError>(ErrorType::ConvertUndefinedToObject);
- auto* obj_arg = interpreter.argument(0).to_object(interpreter);
+ auto* obj_arg = interpreter.argument(0).to_object(interpreter, global_object);
if (interpreter.exception())
return {};
@@ -214,7 +214,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::entries)
if (!interpreter.argument_count())
return interpreter.throw_exception<TypeError>(ErrorType::ConvertUndefinedToObject);
- auto* obj_arg = interpreter.argument(0).to_object(interpreter);
+ auto* obj_arg = interpreter.argument(0).to_object(interpreter, global_object);
if (interpreter.exception())
return {};
diff --git a/Libraries/LibJS/Runtime/ObjectPrototype.cpp b/Libraries/LibJS/Runtime/ObjectPrototype.cpp
index 03e5d68689..80bfb668fc 100644
--- a/Libraries/LibJS/Runtime/ObjectPrototype.cpp
+++ b/Libraries/LibJS/Runtime/ObjectPrototype.cpp
@@ -56,7 +56,7 @@ ObjectPrototype::~ObjectPrototype()
JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::has_own_property)
{
- 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 {};
auto name = interpreter.argument(0).to_string(interpreter);
@@ -67,7 +67,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::has_own_property)
JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::to_string)
{
- 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 {};
return js_string(interpreter, String::format("[object %s]", this_object->class_name()));
@@ -75,7 +75,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::to_string)
JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::to_locale_string)
{
- 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 {};
return this_object->invoke("toString");
@@ -83,7 +83,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::to_locale_string)
JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::value_of)
{
- 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 {};
return this_object->value_of();
diff --git a/Libraries/LibJS/Runtime/Reference.cpp b/Libraries/LibJS/Runtime/Reference.cpp
index 29825de29e..992cdbedd3 100644
--- a/Libraries/LibJS/Runtime/Reference.cpp
+++ b/Libraries/LibJS/Runtime/Reference.cpp
@@ -55,7 +55,7 @@ void Reference::put(Interpreter& interpreter, Value value)
return;
}
- auto* object = base().to_object(interpreter);
+ auto* object = base().to_object(interpreter, interpreter.global_object());
if (!object)
return;
@@ -97,7 +97,7 @@ Value Reference::get(Interpreter& interpreter)
return value;
}
- auto* object = base().to_object(interpreter);
+ auto* object = base().to_object(interpreter, interpreter.global_object());
if (!object)
return {};
diff --git a/Libraries/LibJS/Runtime/ScriptFunction.cpp b/Libraries/LibJS/Runtime/ScriptFunction.cpp
index 48291e693f..c5bf98b587 100644
--- a/Libraries/LibJS/Runtime/ScriptFunction.cpp
+++ b/Libraries/LibJS/Runtime/ScriptFunction.cpp
@@ -37,7 +37,7 @@ namespace JS {
static ScriptFunction* typed_this(Interpreter& interpreter, GlobalObject& global_object)
{
- 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 nullptr;
if (!this_object->is_function()) {
diff --git a/Libraries/LibJS/Runtime/StringConstructor.cpp b/Libraries/LibJS/Runtime/StringConstructor.cpp
index 5ea7f941d3..06b46a48cb 100644
--- a/Libraries/LibJS/Runtime/StringConstructor.cpp
+++ b/Libraries/LibJS/Runtime/StringConstructor.cpp
@@ -78,7 +78,7 @@ Value StringConstructor::construct(Interpreter& interpreter)
JS_DEFINE_NATIVE_FUNCTION(StringConstructor::raw)
{
- auto* template_object = interpreter.argument(0).to_object(interpreter);
+ auto* template_object = interpreter.argument(0).to_object(interpreter, global_object);
if (interpreter.exception())
return {};
@@ -92,7 +92,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringConstructor::raw)
if (!raw.is_array())
return js_string(interpreter, "");
- auto* array = static_cast<Array*>(raw.to_object(interpreter));
+ auto* array = static_cast<Array*>(raw.to_object(interpreter, global_object));
auto& raw_array_elements = array->indexed_properties();
StringBuilder builder;
diff --git a/Libraries/LibJS/Runtime/StringPrototype.cpp b/Libraries/LibJS/Runtime/StringPrototype.cpp
index 017f98cebf..73b6760705 100644
--- a/Libraries/LibJS/Runtime/StringPrototype.cpp
+++ b/Libraries/LibJS/Runtime/StringPrototype.cpp
@@ -41,7 +41,7 @@ namespace JS {
static StringObject* typed_this(Interpreter& interpreter, GlobalObject& global_object)
{
- 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 nullptr;
if (!this_object->is_string_object()) {
@@ -53,7 +53,7 @@ static StringObject* typed_this(Interpreter& interpreter, GlobalObject& global_o
static String ak_string_from(Interpreter& interpreter, GlobalObject& global_object)
{
- 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 {};
return Value(this_object).to_string(interpreter);
diff --git a/Libraries/LibJS/Runtime/SymbolPrototype.cpp b/Libraries/LibJS/Runtime/SymbolPrototype.cpp
index d0660196ad..a6bd6106a9 100644
--- a/Libraries/LibJS/Runtime/SymbolPrototype.cpp
+++ b/Libraries/LibJS/Runtime/SymbolPrototype.cpp
@@ -58,7 +58,7 @@ SymbolPrototype::~SymbolPrototype()
static SymbolObject* typed_this(Interpreter& interpreter, GlobalObject& global_object)
{
- 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 nullptr;
if (!this_object->is_symbol_object()) {
diff --git a/Libraries/LibJS/Runtime/Uint8ClampedArray.cpp b/Libraries/LibJS/Runtime/Uint8ClampedArray.cpp
index f93290f54d..ef5eb6f45d 100644
--- a/Libraries/LibJS/Runtime/Uint8ClampedArray.cpp
+++ b/Libraries/LibJS/Runtime/Uint8ClampedArray.cpp
@@ -55,7 +55,7 @@ Uint8ClampedArray::~Uint8ClampedArray()
JS_DEFINE_NATIVE_GETTER(Uint8ClampedArray::length_getter)
{
- 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 (StringView(this_object->class_name()) != "Uint8ClampedArray")
diff --git a/Libraries/LibJS/Runtime/Value.cpp b/Libraries/LibJS/Runtime/Value.cpp
index 674769f2f5..70ccefda20 100644
--- a/Libraries/LibJS/Runtime/Value.cpp
+++ b/Libraries/LibJS/Runtime/Value.cpp
@@ -207,7 +207,7 @@ Value Value::to_primitive(Interpreter&, PreferredType preferred_type) const
return *this;
}
-Object* Value::to_object(Interpreter& interpreter) const
+Object* Value::to_object(Interpreter& interpreter, GlobalObject& global_object) const
{
switch (m_type) {
case Type::Undefined:
@@ -215,15 +215,15 @@ Object* Value::to_object(Interpreter& interpreter) const
interpreter.throw_exception<TypeError>(ErrorType::ToObjectNullOrUndef);
return nullptr;
case Type::Boolean:
- return BooleanObject::create(interpreter.global_object(), m_value.as_bool);
+ return BooleanObject::create(global_object, m_value.as_bool);
case Type::Number:
- return NumberObject::create(interpreter.global_object(), m_value.as_double);
+ return NumberObject::create(global_object, m_value.as_double);
case Type::String:
- return StringObject::create(interpreter.global_object(), *m_value.as_string);
+ return StringObject::create(global_object, *m_value.as_string);
case Type::Symbol:
- return SymbolObject::create(interpreter.global_object(), *m_value.as_symbol);
+ return SymbolObject::create(global_object, *m_value.as_symbol);
case Type::BigInt:
- return BigIntObject::create(interpreter.global_object(), *m_value.as_bigint);
+ return BigIntObject::create(global_object, *m_value.as_bigint);
case Type::Object:
return &const_cast<Object&>(as_object());
default:
diff --git a/Libraries/LibJS/Runtime/Value.h b/Libraries/LibJS/Runtime/Value.h
index e328488aec..6343003328 100644
--- a/Libraries/LibJS/Runtime/Value.h
+++ b/Libraries/LibJS/Runtime/Value.h
@@ -229,7 +229,7 @@ public:
String to_string(Interpreter&) const;
PrimitiveString* to_primitive_string(Interpreter&);
Value to_primitive(Interpreter&, PreferredType preferred_type = PreferredType::Default) const;
- Object* to_object(Interpreter&) const;
+ Object* to_object(Interpreter&, GlobalObject&) const;
Value to_numeric(Interpreter&) const;
Value to_number(Interpreter&) const;
BigInt* to_bigint(Interpreter&) const;
diff --git a/Libraries/LibWeb/Bindings/CanvasRenderingContext2DWrapper.cpp b/Libraries/LibWeb/Bindings/CanvasRenderingContext2DWrapper.cpp
index eecd6b1b4f..c16b062107 100644
--- a/Libraries/LibWeb/Bindings/CanvasRenderingContext2DWrapper.cpp
+++ b/Libraries/LibWeb/Bindings/CanvasRenderingContext2DWrapper.cpp
@@ -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();
diff --git a/Libraries/LibWeb/Bindings/DocumentWrapper.cpp b/Libraries/LibWeb/Bindings/DocumentWrapper.cpp
index 4e8f35a8c1..9543d3bbbf 100644
--- a/Libraries/LibWeb/Bindings/DocumentWrapper.cpp
+++ b/Libraries/LibWeb/Bindings/DocumentWrapper.cpp
@@ -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())
diff --git a/Libraries/LibWeb/Bindings/ElementWrapper.cpp b/Libraries/LibWeb/Bindings/ElementWrapper.cpp
index 32f82d4570..63787e2f52 100644
--- a/Libraries/LibWeb/Bindings/ElementWrapper.cpp
+++ b/Libraries/LibWeb/Bindings/ElementWrapper.cpp
@@ -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;
diff --git a/Libraries/LibWeb/Bindings/EventTargetWrapper.cpp b/Libraries/LibWeb/Bindings/EventTargetWrapper.cpp
index f6eab59429..805b814fa9 100644
--- a/Libraries/LibWeb/Bindings/EventTargetWrapper.cpp
+++ b/Libraries/LibWeb/Bindings/EventTargetWrapper.cpp
@@ -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)
diff --git a/Libraries/LibWeb/Bindings/HTMLCanvasElementWrapper.cpp b/Libraries/LibWeb/Bindings/HTMLCanvasElementWrapper.cpp
index 111f1a4b4e..b897ea3636 100644
--- a/Libraries/LibWeb/Bindings/HTMLCanvasElementWrapper.cpp
+++ b/Libraries/LibWeb/Bindings/HTMLCanvasElementWrapper.cpp
@@ -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 {};
}
diff --git a/Libraries/LibWeb/Bindings/ImageDataWrapper.cpp b/Libraries/LibWeb/Bindings/ImageDataWrapper.cpp
index a62dcf2f5c..1f7f3ccdfb 100644
--- a/Libraries/LibWeb/Bindings/ImageDataWrapper.cpp
+++ b/Libraries/LibWeb/Bindings/ImageDataWrapper.cpp
@@ -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();
diff --git a/Libraries/LibWeb/Bindings/MouseEventWrapper.cpp b/Libraries/LibWeb/Bindings/MouseEventWrapper.cpp
index 6633bf5a85..09e419b133 100644
--- a/Libraries/LibWeb/Bindings/MouseEventWrapper.cpp
+++ b/Libraries/LibWeb/Bindings/MouseEventWrapper.cpp
@@ -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 {};
}
diff --git a/Libraries/LibWeb/Bindings/WindowObject.cpp b/Libraries/LibWeb/Bindings/WindowObject.cpp
index dc61a06d5c..fda954ff13 100644
--- a/Libraries/LibWeb/Bindings/WindowObject.cpp
+++ b/Libraries/LibWeb/Bindings/WindowObject.cpp
@@ -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());
diff --git a/Libraries/LibWeb/Bindings/XMLHttpRequestPrototype.cpp b/Libraries/LibWeb/Bindings/XMLHttpRequestPrototype.cpp
index 98dc397b3a..079ddcb0dd 100644
--- a/Libraries/LibWeb/Bindings/XMLHttpRequestPrototype.cpp
+++ b/Libraries/LibWeb/Bindings/XMLHttpRequestPrototype.cpp
@@ -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());