summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-08-20 09:48:43 +0100
committerLinus Groh <mail@linusgroh.de>2022-08-23 13:58:30 +0100
commit999da617c5a59f2c8bc8b199c69014ee04668ee1 (patch)
tree501d5e7ea375319fa8fb8f4385f6fecd6f76c338 /Userland/Libraries/LibWeb
parentf3117d46dc872a2d0f57273293b5691777b06279 (diff)
downloadserenity-999da617c5a59f2c8bc8b199c69014ee04668ee1.zip
LibJS: Remove GlobalObject from VM::this_value()
This is a continuation of the previous six commits. The global object is only needed to return it if the execution context stack is empty, but that doesn't seem like a useful thing to allow in the first place - if you're not currently executing JS, and the execution context stack is empty, there is no this value to retrieve.
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/Bindings/LocationObject.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Bindings/Replaceable.h2
-rw-r--r--Userland/Libraries/LibWeb/Bindings/WindowObject.cpp2
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp2
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp4
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp8
6 files changed, 10 insertions, 10 deletions
diff --git a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp
index b2b16cb58d..bc9c15c256 100644
--- a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp
@@ -76,7 +76,7 @@ AK::URL LocationObject::url() const
static JS::ThrowCompletionOr<LocationObject*> typed_this_value(JS::GlobalObject& global_object)
{
auto& vm = global_object.vm();
- auto this_value = vm.this_value(global_object);
+ auto this_value = vm.this_value();
if (!this_value.is_object() || !is<LocationObject>(this_value.as_object()))
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "Location");
return static_cast<LocationObject*>(&this_value.as_object());
diff --git a/Userland/Libraries/LibWeb/Bindings/Replaceable.h b/Userland/Libraries/LibWeb/Bindings/Replaceable.h
index a669e1d183..6ed3883935 100644
--- a/Userland/Libraries/LibWeb/Bindings/Replaceable.h
+++ b/Userland/Libraries/LibWeb/Bindings/Replaceable.h
@@ -7,7 +7,7 @@
#pragma once
#define REPLACEABLE_PROPERTY_SETTER(ObjectType, property) \
- auto this_value = vm.this_value(global_object); \
+ auto this_value = vm.this_value(); \
if (!this_value.is_object() || !is<ObjectType>(this_value.as_object())) \
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, #ObjectType); \
TRY(this_value.as_object().internal_define_own_property( \
diff --git a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp
index 9760131aa8..a528a91dc8 100644
--- a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp
@@ -180,7 +180,7 @@ static JS::ThrowCompletionOr<HTML::Window*> impl_from(JS::VM& vm, JS::GlobalObje
// this_value to a specific object type in the bindings. But since window is
// the global object we make an exception here.
// This allows calls like `setTimeout(f, 10)` to work.
- auto this_value = vm.this_value(global_object);
+ auto this_value = vm.this_value();
if (this_value.is_nullish())
this_value = &global_object;
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp
index 17cb7ef488..961ff4314d 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp
@@ -18,7 +18,7 @@ void WebAssemblyInstancePrototype::initialize(JS::Realm& realm)
JS_DEFINE_NATIVE_FUNCTION(WebAssemblyInstancePrototype::exports_getter)
{
- auto this_value = vm.this_value(global_object);
+ auto this_value = vm.this_value();
auto* this_object = TRY(this_value.to_object(global_object));
if (!is<WebAssemblyInstanceObject>(this_object))
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebAssembly.Instance");
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp
index 840752a84a..c3ec451433 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp
@@ -20,7 +20,7 @@ void WebAssemblyMemoryPrototype::initialize(JS::Realm& realm)
JS_DEFINE_NATIVE_FUNCTION(WebAssemblyMemoryPrototype::grow)
{
auto page_count = TRY(vm.argument(0).to_u32(global_object));
- auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
+ auto* this_object = TRY(vm.this_value().to_object(global_object));
if (!is<WebAssemblyMemoryObject>(this_object))
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebAssembly.Memory");
auto* memory_object = static_cast<WebAssemblyMemoryObject*>(this_object);
@@ -40,7 +40,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyMemoryPrototype::buffer_getter)
{
auto& realm = *global_object.associated_realm();
- auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
+ auto* this_object = TRY(vm.this_value().to_object(global_object));
if (!is<WebAssemblyMemoryObject>(this_object))
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebAssembly.Memory");
auto* memory_object = static_cast<WebAssemblyMemoryObject*>(this_object);
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp
index ff915e5207..d51b9cd46b 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp
@@ -23,7 +23,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::grow)
{
auto delta = TRY(vm.argument(0).to_u32(global_object));
- auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
+ auto* this_object = TRY(vm.this_value().to_object(global_object));
if (!is<WebAssemblyTableObject>(this_object))
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebAssembly.Table");
auto* table_object = static_cast<WebAssemblyTableObject*>(this_object);
@@ -53,7 +53,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::get)
{
auto index = TRY(vm.argument(0).to_u32(global_object));
- auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
+ auto* this_object = TRY(vm.this_value().to_object(global_object));
if (!is<WebAssemblyTableObject>(this_object))
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebAssembly.Table");
auto* table_object = static_cast<WebAssemblyTableObject*>(this_object);
@@ -77,7 +77,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::set)
{
auto index = TRY(vm.argument(0).to_u32(global_object));
- auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
+ auto* this_object = TRY(vm.this_value().to_object(global_object));
if (!is<WebAssemblyTableObject>(this_object))
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebAssembly.Table");
auto* table_object = static_cast<WebAssemblyTableObject*>(this_object);
@@ -105,7 +105,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::set)
JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::length_getter)
{
- auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
+ auto* this_object = TRY(vm.this_value().to_object(global_object));
if (!is<WebAssemblyTableObject>(this_object))
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebAssembly.Table");
auto* table_object = static_cast<WebAssemblyTableObject*>(this_object);