summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Bindings/CSSNamespace.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Bindings/CrossOriginAbstractOperations.cpp6
-rw-r--r--Userland/Libraries/LibWeb/Bindings/ExceptionOrUtils.h4
-rw-r--r--Userland/Libraries/LibWeb/Bindings/IDLAbstractOperations.h4
-rw-r--r--Userland/Libraries/LibWeb/Bindings/ImageConstructor.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Bindings/LocationConstructor.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Bindings/LocationObject.cpp8
-rw-r--r--Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Bindings/NavigatorConstructor.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Bindings/OptionConstructor.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Bindings/Replaceable.h14
-rw-r--r--Userland/Libraries/LibWeb/Bindings/WindowConstructor.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Bindings/WindowObject.cpp38
-rw-r--r--Userland/Libraries/LibWeb/Bindings/WindowProxy.cpp6
-rw-r--r--Userland/Libraries/LibWeb/Fetch/Headers.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Fetch/HeadersIterator.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp2
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.cpp4
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp2
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp8
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp6
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleConstructor.cpp2
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp26
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp10
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp14
-rw-r--r--Userland/Libraries/LibWeb/WebGL/WebGLContextAttributes.cpp4
27 files changed, 93 insertions, 93 deletions
diff --git a/Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp b/Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp
index 7fa1bbe632..58c65dce33 100644
--- a/Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp
@@ -31,7 +31,7 @@ void AudioConstructor::initialize(JS::Realm& realm)
JS::ThrowCompletionOr<JS::Value> AudioConstructor::call()
{
- return vm().throw_completion<JS::TypeError>(global_object(), JS::ErrorType::ConstructorWithoutNew, "Audio");
+ return vm().throw_completion<JS::TypeError>(JS::ErrorType::ConstructorWithoutNew, "Audio");
}
// https://html.spec.whatwg.org/multipage/media.html#dom-audio
diff --git a/Userland/Libraries/LibWeb/Bindings/CSSNamespace.cpp b/Userland/Libraries/LibWeb/Bindings/CSSNamespace.cpp
index 943d1a0c01..9fda7fe77b 100644
--- a/Userland/Libraries/LibWeb/Bindings/CSSNamespace.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/CSSNamespace.cpp
@@ -30,7 +30,7 @@ void CSSNamespace::initialize(JS::Realm& realm)
JS_DEFINE_NATIVE_FUNCTION(CSSNamespace::escape)
{
if (!vm.argument_count())
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::BadArgCountAtLeastOne, "CSS.escape");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::BadArgCountAtLeastOne, "CSS.escape");
auto identifier = TRY(vm.argument(0).to_string(global_object));
return JS::js_string(vm, Web::CSS::serialize_an_identifier(identifier));
@@ -40,7 +40,7 @@ JS_DEFINE_NATIVE_FUNCTION(CSSNamespace::escape)
JS_DEFINE_NATIVE_FUNCTION(CSSNamespace::supports)
{
if (!vm.argument_count())
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::BadArgCountAtLeastOne, "CSS.supports");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::BadArgCountAtLeastOne, "CSS.supports");
if (vm.argument_count() >= 2) {
// When the supports(property, value) method is invoked with two arguments property and value:
diff --git a/Userland/Libraries/LibWeb/Bindings/CrossOriginAbstractOperations.cpp b/Userland/Libraries/LibWeb/Bindings/CrossOriginAbstractOperations.cpp
index c4fdcae3de..db325cf8c0 100644
--- a/Userland/Libraries/LibWeb/Bindings/CrossOriginAbstractOperations.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/CrossOriginAbstractOperations.cpp
@@ -81,7 +81,7 @@ JS::ThrowCompletionOr<JS::PropertyDescriptor> cross_origin_property_fallback(JS:
return JS::PropertyDescriptor { .value = JS::js_undefined(), .writable = false, .enumerable = false, .configurable = true };
// 2. Throw a "SecurityError" DOMException.
- return vm.throw_completion<DOMExceptionWrapper>(global_object, DOM::SecurityError::create(String::formatted("Can't access property '{}' on cross-origin object", property_key)));
+ return vm.throw_completion<DOMExceptionWrapper>(DOM::SecurityError::create(String::formatted("Can't access property '{}' on cross-origin object", property_key)));
}
// 7.2.3.3 IsPlatformObjectSameOrigin ( O ), https://html.spec.whatwg.org/multipage/browsers.html#isplatformobjectsameorigin-(-o-)
@@ -201,7 +201,7 @@ JS::ThrowCompletionOr<JS::Value> cross_origin_get(JS::GlobalObject& global_objec
// 6. If getter is undefined, then throw a "SecurityError" DOMException.
if (!getter.has_value())
- return vm.throw_completion<DOMExceptionWrapper>(global_object, DOM::SecurityError::create(String::formatted("Can't get property '{}' on cross-origin object", property_key)));
+ return vm.throw_completion<DOMExceptionWrapper>(DOM::SecurityError::create(String::formatted("Can't get property '{}' on cross-origin object", property_key)));
// 7. Return ? Call(getter, Receiver).
return JS::call(global_object, *getter, receiver);
@@ -229,7 +229,7 @@ JS::ThrowCompletionOr<bool> cross_origin_set(JS::GlobalObject& global_object, JS
}
// 4. Throw a "SecurityError" DOMException.
- return vm.throw_completion<DOMExceptionWrapper>(global_object, DOM::SecurityError::create(String::formatted("Can't set property '{}' on cross-origin object", property_key)));
+ return vm.throw_completion<DOMExceptionWrapper>(DOM::SecurityError::create(String::formatted("Can't set property '{}' on cross-origin object", property_key)));
}
// 7.2.3.7 CrossOriginOwnPropertyKeys ( O ), https://html.spec.whatwg.org/multipage/browsers.html#crossoriginownpropertykeys-(-o-)
diff --git a/Userland/Libraries/LibWeb/Bindings/ExceptionOrUtils.h b/Userland/Libraries/LibWeb/Bindings/ExceptionOrUtils.h
index c023c362d6..9e0bf4e103 100644
--- a/Userland/Libraries/LibWeb/Bindings/ExceptionOrUtils.h
+++ b/Userland/Libraries/LibWeb/Bindings/ExceptionOrUtils.h
@@ -67,7 +67,7 @@ ALWAYS_INLINE JS::Completion dom_exception_to_throw_completion(auto&& global_obj
switch (exception.type) {
#define E(x) \
case DOM::SimpleExceptionType::x: \
- return vm.template throw_completion<JS::x>(global_object, exception.message);
+ return vm.template throw_completion<JS::x>(exception.message);
ENUMERATE_SIMPLE_WEBIDL_EXCEPTION_TYPES(E)
@@ -77,7 +77,7 @@ ALWAYS_INLINE JS::Completion dom_exception_to_throw_completion(auto&& global_obj
}
},
[&](NonnullRefPtr<DOM::DOMException> exception) {
- return vm.template throw_completion<DOMExceptionWrapper>(global_object, move(exception));
+ return vm.template throw_completion<DOMExceptionWrapper>(move(exception));
});
}
diff --git a/Userland/Libraries/LibWeb/Bindings/IDLAbstractOperations.h b/Userland/Libraries/LibWeb/Bindings/IDLAbstractOperations.h
index 8efaabaf7c..57a0f8a65f 100644
--- a/Userland/Libraries/LibWeb/Bindings/IDLAbstractOperations.h
+++ b/Userland/Libraries/LibWeb/Bindings/IDLAbstractOperations.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
- * Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
+ * Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -88,7 +88,7 @@ JS::Completion call_user_object_operation(Bindings::CallbackType& callback, Stri
// 4. If ! IsCallable(X) is false, then set completion to a new Completion{[[Type]]: throw, [[Value]]: a newly created TypeError object, [[Target]]: empty}, and jump to the step labeled return.
if (!get_result.value().is_function()) {
- completion = realm.vm().template throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAFunction, get_result.value().to_string_without_side_effects());
+ completion = realm.vm().template throw_completion<JS::TypeError>(JS::ErrorType::NotAFunction, get_result.value().to_string_without_side_effects());
return clean_up_on_return(stored_settings, relevant_settings, completion);
}
diff --git a/Userland/Libraries/LibWeb/Bindings/ImageConstructor.cpp b/Userland/Libraries/LibWeb/Bindings/ImageConstructor.cpp
index 48157f754a..105af8a6d9 100644
--- a/Userland/Libraries/LibWeb/Bindings/ImageConstructor.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/ImageConstructor.cpp
@@ -31,7 +31,7 @@ void ImageConstructor::initialize(JS::Realm& realm)
JS::ThrowCompletionOr<JS::Value> ImageConstructor::call()
{
- return vm().throw_completion<JS::TypeError>(global_object(), JS::ErrorType::ConstructorWithoutNew, "Image");
+ return vm().throw_completion<JS::TypeError>(JS::ErrorType::ConstructorWithoutNew, "Image");
}
// https://html.spec.whatwg.org/multipage/embedded-content.html#dom-image
diff --git a/Userland/Libraries/LibWeb/Bindings/LocationConstructor.cpp b/Userland/Libraries/LibWeb/Bindings/LocationConstructor.cpp
index 7158152b17..94aa81905f 100644
--- a/Userland/Libraries/LibWeb/Bindings/LocationConstructor.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/LocationConstructor.cpp
@@ -20,12 +20,12 @@ LocationConstructor::~LocationConstructor() = default;
JS::ThrowCompletionOr<JS::Value> LocationConstructor::call()
{
- return vm().throw_completion<JS::TypeError>(global_object(), JS::ErrorType::ConstructorWithoutNew, "Location");
+ return vm().throw_completion<JS::TypeError>(JS::ErrorType::ConstructorWithoutNew, "Location");
}
JS::ThrowCompletionOr<JS::Object*> LocationConstructor::construct(FunctionObject&)
{
- return vm().throw_completion<JS::TypeError>(global_object(), JS::ErrorType::NotAConstructor, "Location");
+ return vm().throw_completion<JS::TypeError>(JS::ErrorType::NotAConstructor, "Location");
}
void LocationConstructor::initialize(JS::Realm& realm)
diff --git a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp
index 93b62b166e..b2b16cb58d 100644
--- a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp
@@ -78,7 +78,7 @@ static JS::ThrowCompletionOr<LocationObject*> typed_this_value(JS::GlobalObject&
auto& vm = global_object.vm();
auto this_value = vm.this_value(global_object);
if (!this_value.is_object() || !is<LocationObject>(this_value.as_object()))
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "Location");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "Location");
return static_cast<LocationObject*>(&this_value.as_object());
}
@@ -104,7 +104,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::href_setter)
auto new_href = TRY(vm.argument(0).to_string(global_object));
auto href_url = window.impl().associated_document().parse_url(new_href);
if (!href_url.is_valid())
- return vm.throw_completion<JS::URIError>(global_object, String::formatted("Invalid URL '{}'", new_href));
+ return vm.throw_completion<JS::URIError>(String::formatted("Invalid URL '{}'", new_href));
// 3. Location-object navigate given the resulting URL record.
window.impl().did_set_location_href({}, href_url);
@@ -313,7 +313,7 @@ JS::ThrowCompletionOr<bool> LocationObject::internal_define_own_property(JS::Pro
}
// 2. Throw a "SecurityError" DOMException.
- return vm.throw_completion<DOMExceptionWrapper>(global_object, DOM::SecurityError::create(String::formatted("Can't define property '{}' on cross-origin object", property_key)));
+ return vm.throw_completion<DOMExceptionWrapper>(DOM::SecurityError::create(String::formatted("Can't define property '{}' on cross-origin object", property_key)));
}
// 7.10.5.7 [[Get]] ( P, Receiver ), https://html.spec.whatwg.org/multipage/history.html#location-get
@@ -353,7 +353,7 @@ JS::ThrowCompletionOr<bool> LocationObject::internal_delete(JS::PropertyKey cons
return JS::Object::internal_delete(property_key);
// 2. Throw a "SecurityError" DOMException.
- return vm.throw_completion<DOMExceptionWrapper>(global_object, DOM::SecurityError::create(String::formatted("Can't delete property '{}' on cross-origin object", property_key)));
+ return vm.throw_completion<DOMExceptionWrapper>(DOM::SecurityError::create(String::formatted("Can't delete property '{}' on cross-origin object", property_key)));
}
// 7.10.5.10 [[OwnPropertyKeys]] ( ), https://html.spec.whatwg.org/multipage/history.html#location-ownpropertykeys
diff --git a/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp b/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp
index 5c57f24cfe..e5a74231c7 100644
--- a/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp
@@ -284,7 +284,7 @@ JS::VM& main_thread_vm()
// FIXME: Implement 8.1.5.4.4 HostGetSupportedImportAssertions(), https://html.spec.whatwg.org/multipage/webappapis.html#hostgetsupportedimportassertions
vm->host_resolve_imported_module = [&](JS::ScriptOrModule, JS::ModuleRequest const&) -> JS::ThrowCompletionOr<NonnullRefPtr<JS::Module>> {
- return vm->throw_completion<JS::InternalError>(vm->current_realm()->global_object(), JS::ErrorType::NotImplemented, "Modules in the browser");
+ return vm->throw_completion<JS::InternalError>(JS::ErrorType::NotImplemented, "Modules in the browser");
};
// NOTE: We push a dummy execution context onto the JS execution context stack,
diff --git a/Userland/Libraries/LibWeb/Bindings/NavigatorConstructor.cpp b/Userland/Libraries/LibWeb/Bindings/NavigatorConstructor.cpp
index 560033963f..92b897893e 100644
--- a/Userland/Libraries/LibWeb/Bindings/NavigatorConstructor.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/NavigatorConstructor.cpp
@@ -20,12 +20,12 @@ NavigatorConstructor::~NavigatorConstructor() = default;
JS::ThrowCompletionOr<JS::Value> NavigatorConstructor::call()
{
- return vm().throw_completion<JS::TypeError>(global_object(), JS::ErrorType::ConstructorWithoutNew, "Navigator");
+ return vm().throw_completion<JS::TypeError>(JS::ErrorType::ConstructorWithoutNew, "Navigator");
}
JS::ThrowCompletionOr<JS::Object*> NavigatorConstructor::construct(FunctionObject&)
{
- return vm().throw_completion<JS::TypeError>(global_object(), JS::ErrorType::NotAConstructor, "Navigator");
+ return vm().throw_completion<JS::TypeError>(JS::ErrorType::NotAConstructor, "Navigator");
}
void NavigatorConstructor::initialize(JS::Realm& realm)
diff --git a/Userland/Libraries/LibWeb/Bindings/OptionConstructor.cpp b/Userland/Libraries/LibWeb/Bindings/OptionConstructor.cpp
index 330f34b334..47c45376ef 100644
--- a/Userland/Libraries/LibWeb/Bindings/OptionConstructor.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/OptionConstructor.cpp
@@ -32,7 +32,7 @@ void OptionConstructor::initialize(JS::Realm& realm)
JS::ThrowCompletionOr<JS::Value> OptionConstructor::call()
{
- return vm().throw_completion<JS::TypeError>(global_object(), JS::ErrorType::ConstructorWithoutNew, "Option");
+ return vm().throw_completion<JS::TypeError>(JS::ErrorType::ConstructorWithoutNew, "Option");
}
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-option
diff --git a/Userland/Libraries/LibWeb/Bindings/Replaceable.h b/Userland/Libraries/LibWeb/Bindings/Replaceable.h
index 3633c821ef..a669e1d183 100644
--- a/Userland/Libraries/LibWeb/Bindings/Replaceable.h
+++ b/Userland/Libraries/LibWeb/Bindings/Replaceable.h
@@ -1,15 +1,15 @@
/*
- * Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
+ * Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
-#define REPLACEABLE_PROPERTY_SETTER(ObjectType, property) \
- auto this_value = vm.this_value(global_object); \
- if (!this_value.is_object() || !is<ObjectType>(this_value.as_object())) \
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, #ObjectType); \
- TRY(this_value.as_object().internal_define_own_property( \
- #property, JS::PropertyDescriptor { .value = vm.argument(0), .writable = true })); \
+#define REPLACEABLE_PROPERTY_SETTER(ObjectType, property) \
+ auto this_value = vm.this_value(global_object); \
+ 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( \
+ #property, JS::PropertyDescriptor { .value = vm.argument(0), .writable = true })); \
return JS::js_undefined();
diff --git a/Userland/Libraries/LibWeb/Bindings/WindowConstructor.cpp b/Userland/Libraries/LibWeb/Bindings/WindowConstructor.cpp
index 185fe1d991..946aff9007 100644
--- a/Userland/Libraries/LibWeb/Bindings/WindowConstructor.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/WindowConstructor.cpp
@@ -20,12 +20,12 @@ WindowConstructor::~WindowConstructor() = default;
JS::ThrowCompletionOr<JS::Value> WindowConstructor::call()
{
- return vm().throw_completion<JS::TypeError>(global_object(), JS::ErrorType::ConstructorWithoutNew, "Window");
+ return vm().throw_completion<JS::TypeError>(JS::ErrorType::ConstructorWithoutNew, "Window");
}
JS::ThrowCompletionOr<JS::Object*> WindowConstructor::construct(FunctionObject&)
{
- return vm().throw_completion<JS::TypeError>(global_object(), JS::ErrorType::NotAConstructor, "Window");
+ return vm().throw_completion<JS::TypeError>(JS::ErrorType::NotAConstructor, "Window");
}
void WindowConstructor::initialize(JS::Realm& realm)
diff --git a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp
index 985e8a2451..9760131aa8 100644
--- a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp
@@ -187,7 +187,7 @@ static JS::ThrowCompletionOr<HTML::Window*> impl_from(JS::VM& vm, JS::GlobalObje
auto* this_object = MUST(this_value.to_object(global_object));
if (!is<WindowObject>(*this_object))
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WindowObject");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WindowObject");
return &static_cast<WindowObject*>(this_object)->impl();
}
@@ -242,7 +242,7 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::set_timeout)
auto* impl = TRY(impl_from(vm, global_object));
if (!vm.argument_count())
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::BadArgCountAtLeastOne, "setTimeout");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::BadArgCountAtLeastOne, "setTimeout");
auto handler = TRY(make_timer_handler(global_object, vm.argument(0)));
@@ -264,7 +264,7 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::set_interval)
auto* impl = TRY(impl_from(vm, global_object));
if (!vm.argument_count())
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::BadArgCountAtLeastOne, "setInterval");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::BadArgCountAtLeastOne, "setInterval");
auto handler = TRY(make_timer_handler(global_object, vm.argument(0)));
@@ -310,10 +310,10 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::request_animation_frame)
{
auto* impl = TRY(impl_from(vm, global_object));
if (!vm.argument_count())
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::BadArgCountOne, "requestAnimationFrame");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::BadArgCountOne, "requestAnimationFrame");
auto* callback_object = TRY(vm.argument(0).to_object(global_object));
if (!callback_object->is_function())
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAFunctionNoParam);
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAFunctionNoParam);
NonnullOwnPtr<Bindings::CallbackType> callback = adopt_own(*new Bindings::CallbackType(JS::make_handle(callback_object), HTML::incumbent_settings_object()));
return JS::Value(impl->request_animation_frame(move(callback)));
}
@@ -322,7 +322,7 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::cancel_animation_frame)
{
auto* impl = TRY(impl_from(vm, global_object));
if (!vm.argument_count())
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::BadArgCountOne, "cancelAnimationFrame");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::BadArgCountOne, "cancelAnimationFrame");
auto id = TRY(vm.argument(0).to_i32(global_object));
impl->cancel_animation_frame(id);
return JS::js_undefined();
@@ -332,10 +332,10 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::queue_microtask)
{
auto* impl = TRY(impl_from(vm, global_object));
if (!vm.argument_count())
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::BadArgCountAtLeastOne, "queueMicrotask");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::BadArgCountAtLeastOne, "queueMicrotask");
auto* callback_object = TRY(vm.argument(0).to_object(global_object));
if (!callback_object->is_function())
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAFunctionNoParam);
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAFunctionNoParam);
auto callback = adopt_own(*new Bindings::CallbackType(JS::make_handle(callback_object), HTML::incumbent_settings_object()));
@@ -347,10 +347,10 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::request_idle_callback)
{
auto* impl = TRY(impl_from(vm, global_object));
if (!vm.argument_count())
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::BadArgCountAtLeastOne, "requestIdleCallback");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::BadArgCountAtLeastOne, "requestIdleCallback");
auto* callback_object = TRY(vm.argument(0).to_object(global_object));
if (!callback_object->is_function())
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAFunctionNoParam);
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAFunctionNoParam);
// FIXME: accept options object
auto callback = adopt_own(*new Bindings::CallbackType(JS::make_handle(callback_object), HTML::incumbent_settings_object()));
@@ -362,7 +362,7 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::cancel_idle_callback)
{
auto* impl = TRY(impl_from(vm, global_object));
if (!vm.argument_count())
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::BadArgCountOne, "cancelIdleCallback");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::BadArgCountOne, "cancelIdleCallback");
auto id = TRY(vm.argument(0).to_u32(global_object));
impl->cancel_idle_callback(id);
return JS::js_undefined();
@@ -371,11 +371,11 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::cancel_idle_callback)
JS_DEFINE_NATIVE_FUNCTION(WindowObject::atob)
{
if (!vm.argument_count())
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::BadArgCountOne, "atob");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::BadArgCountOne, "atob");
auto string = TRY(vm.argument(0).to_string(global_object));
auto decoded = decode_base64(StringView(string));
if (decoded.is_error())
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::InvalidFormat, "Base64");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::InvalidFormat, "Base64");
// decode_base64() returns a byte string. LibJS uses UTF-8 for strings. Use Latin1Decoder to convert bytes 128-255 to UTF-8.
auto decoder = TextCodec::decoder_for("windows-1252");
@@ -386,14 +386,14 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::atob)
JS_DEFINE_NATIVE_FUNCTION(WindowObject::btoa)
{
if (!vm.argument_count())
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::BadArgCountOne, "btoa");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::BadArgCountOne, "btoa");
auto string = TRY(vm.argument(0).to_string(global_object));
Vector<u8> byte_string;
byte_string.ensure_capacity(string.length());
for (u32 code_point : Utf8View(string)) {
if (code_point > 0xff)
- return vm.throw_completion<JS::InvalidCharacterError>(global_object, JS::ErrorType::NotAByteString, "btoa");
+ return vm.throw_completion<JS::InvalidCharacterError>(JS::ErrorType::NotAByteString, "btoa");
byte_string.append(code_point);
}
@@ -441,7 +441,7 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::performance_setter)
// https://webidl.spec.whatwg.org/#dfn-attribute-setter
// 4.1. If no arguments were passed, then throw a TypeError.
if (vm.argument_count() == 0)
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::BadArgCountOne, "set performance");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::BadArgCountOne, "set performance");
auto* impl = TRY(impl_from(vm, global_object));
@@ -517,7 +517,7 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::get_computed_style)
auto* impl = TRY(impl_from(vm, global_object));
auto* object = TRY(vm.argument(0).to_object(global_object));
if (!is<ElementWrapper>(object))
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "DOM element");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "DOM element");
return wrap(global_object, impl->get_computed_style(static_cast<ElementWrapper*>(object)->impl()));
}
@@ -592,7 +592,7 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::scroll)
if (!behavior_string_value.is_undefined())
behavior_string = TRY(behavior_string_value.to_string(global_object));
if (behavior_string != "smooth" && behavior_string != "auto")
- return vm.throw_completion<JS::TypeError>(global_object, "Behavior is not one of 'smooth' or 'auto'");
+ return vm.throw_completion<JS::TypeError>("Behavior is not one of 'smooth' or 'auto'");
} else if (vm.argument_count() >= 2) {
// We ignore arguments 2+ in line with behavior of Chrome and Firefox
@@ -655,7 +655,7 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::scroll_by)
auto behavior_string_value = TRY(options->get("behavior"));
auto behavior_string = behavior_string_value.is_undefined() ? "auto" : TRY(behavior_string_value.to_string(global_object));
if (behavior_string != "smooth" && behavior_string != "auto")
- return vm.throw_completion<JS::TypeError>(global_object, "Behavior is not one of 'smooth' or 'auto'");
+ return vm.throw_completion<JS::TypeError>("Behavior is not one of 'smooth' or 'auto'");
ScrollBehavior behavior = (behavior_string == "smooth") ? ScrollBehavior::Smooth : ScrollBehavior::Auto;
// FIXME: Spec wants us to call scroll(options) here.
diff --git a/Userland/Libraries/LibWeb/Bindings/WindowProxy.cpp b/Userland/Libraries/LibWeb/Bindings/WindowProxy.cpp
index 822b63bff3..8acf44d5dd 100644
--- a/Userland/Libraries/LibWeb/Bindings/WindowProxy.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/WindowProxy.cpp
@@ -93,7 +93,7 @@ JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> WindowProxy::internal_ge
return Optional<JS::PropertyDescriptor> {};
// 2. Throw a "SecurityError" DOMException.
- return vm.throw_completion<DOMExceptionWrapper>(global_object, DOM::SecurityError::create(String::formatted("Can't access property '{}' on cross-origin object", property_key)));
+ return vm.throw_completion<DOMExceptionWrapper>(DOM::SecurityError::create(String::formatted("Can't access property '{}' on cross-origin object", property_key)));
}
// 6. Return PropertyDescriptor{ [[Value]]: value, [[Writable]]: false, [[Enumerable]]: true, [[Configurable]]: true }.
@@ -146,7 +146,7 @@ JS::ThrowCompletionOr<bool> WindowProxy::internal_define_own_property(JS::Proper
}
// 3. Throw a "SecurityError" DOMException.
- return vm.throw_completion<DOMExceptionWrapper>(global_object, DOM::SecurityError::create(String::formatted("Can't define property '{}' on cross-origin object", property_key)));
+ return vm.throw_completion<DOMExceptionWrapper>(DOM::SecurityError::create(String::formatted("Can't define property '{}' on cross-origin object", property_key)));
}
// 7.4.7 [[Get]] ( P, Receiver ), https://html.spec.whatwg.org/multipage/window-object.html#windowproxy-get
@@ -222,7 +222,7 @@ JS::ThrowCompletionOr<bool> WindowProxy::internal_delete(JS::PropertyKey const&
}
// 3. Throw a "SecurityError" DOMException.
- return vm.throw_completion<DOMExceptionWrapper>(global_object, DOM::SecurityError::create(String::formatted("Can't delete property '{}' on cross-origin object", property_key)));
+ return vm.throw_completion<DOMExceptionWrapper>(DOM::SecurityError::create(String::formatted("Can't delete property '{}' on cross-origin object", property_key)));
}
// 7.4.10 [[OwnPropertyKeys]] ( ), https://html.spec.whatwg.org/multipage/window-object.html#windowproxy-ownpropertykeys
diff --git a/Userland/Libraries/LibWeb/Fetch/Headers.cpp b/Userland/Libraries/LibWeb/Fetch/Headers.cpp
index 72bfc49966..24a754e31b 100644
--- a/Userland/Libraries/LibWeb/Fetch/Headers.cpp
+++ b/Userland/Libraries/LibWeb/Fetch/Headers.cpp
@@ -165,7 +165,7 @@ JS::ThrowCompletionOr<void> Headers::for_each(ForEachCallback callback)
auto value_pairs_to_iterate_over = [&]() -> JS::ThrowCompletionOr<Vector<Fetch::Infrastructure::Header>> {
auto headers_or_error = m_header_list.sort_and_combine();
if (headers_or_error.is_error())
- return vm.throw_completion<JS::InternalError>(global_object, JS::ErrorType::NotEnoughMemoryToAllocate);
+ return vm.throw_completion<JS::InternalError>(JS::ErrorType::NotEnoughMemoryToAllocate);
return headers_or_error.release_value();
};
diff --git a/Userland/Libraries/LibWeb/Fetch/HeadersIterator.cpp b/Userland/Libraries/LibWeb/Fetch/HeadersIterator.cpp
index 732869a068..a7dd7c4073 100644
--- a/Userland/Libraries/LibWeb/Fetch/HeadersIterator.cpp
+++ b/Userland/Libraries/LibWeb/Fetch/HeadersIterator.cpp
@@ -23,7 +23,7 @@ JS::ThrowCompletionOr<JS::Object*> HeadersIterator::next()
auto value_pairs_to_iterate_over = [&]() -> JS::ThrowCompletionOr<Vector<Fetch::Infrastructure::Header>> {
auto headers_or_error = m_headers.m_header_list.sort_and_combine();
if (headers_or_error.is_error())
- return vm.throw_completion<JS::InternalError>(global_object, JS::ErrorType::NotEnoughMemoryToAllocate);
+ return vm.throw_completion<JS::InternalError>(JS::ErrorType::NotEnoughMemoryToAllocate);
return headers_or_error.release_value();
};
diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp
index b161dd6db3..8b19eaeb1c 100644
--- a/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp
@@ -89,7 +89,7 @@ JS::Completion ClassicScript::run(RethrowErrors rethrow_errors)
// 5. If script's error to rethrow is not null, then set evaluationStatus to Completion { [[Type]]: throw, [[Value]]: script's error to rethrow, [[Target]]: empty }.
if (m_error_to_rethrow.has_value()) {
- evaluation_status = vm.throw_completion<JS::SyntaxError>(global_object, m_error_to_rethrow.value().to_string());
+ evaluation_status = vm.throw_completion<JS::SyntaxError>(m_error_to_rethrow.value().to_string());
} else {
auto timer = Core::ElapsedTimer::start_new();
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.cpp
index afaa28d2cd..08ed20f191 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.cpp
@@ -23,7 +23,7 @@ WebAssemblyInstanceConstructor::~WebAssemblyInstanceConstructor() = default;
JS::ThrowCompletionOr<JS::Value> WebAssemblyInstanceConstructor::call()
{
- return vm().throw_completion<JS::TypeError>(global_object(), JS::ErrorType::ConstructorWithoutNew, "WebAssembly.Instance");
+ return vm().throw_completion<JS::TypeError>(JS::ErrorType::ConstructorWithoutNew, "WebAssembly.Instance");
}
JS::ThrowCompletionOr<JS::Object*> WebAssemblyInstanceConstructor::construct(FunctionObject&)
@@ -34,7 +34,7 @@ JS::ThrowCompletionOr<JS::Object*> WebAssemblyInstanceConstructor::construct(Fun
auto* module_argument = TRY(vm.argument(0).to_object(global_object));
if (!is<WebAssemblyModuleObject>(module_argument))
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WebAssembly.Module");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebAssembly.Module");
auto& module_object = static_cast<WebAssemblyModuleObject&>(*module_argument);
auto result = TRY(WebAssemblyObject::instantiate_module(module_object.module(), vm, global_object));
return heap().allocate<WebAssemblyInstanceObject>(realm, realm, result);
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp
index bc5580cdc9..17cb7ef488 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp
@@ -21,7 +21,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyInstancePrototype::exports_getter)
auto this_value = vm.this_value(global_object);
auto* this_object = TRY(this_value.to_object(global_object));
if (!is<WebAssemblyInstanceObject>(this_object))
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WebAssembly.Instance");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebAssembly.Instance");
auto object = static_cast<WebAssemblyInstanceObject*>(this_object);
return object->m_exports_object;
}
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp
index 1e5a99744d..7150dc3e5e 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp
@@ -21,7 +21,7 @@ WebAssemblyMemoryConstructor::~WebAssemblyMemoryConstructor() = default;
JS::ThrowCompletionOr<JS::Value> WebAssemblyMemoryConstructor::call()
{
- return vm().throw_completion<JS::TypeError>(global_object(), JS::ErrorType::ConstructorWithoutNew, "WebAssembly.Memory");
+ return vm().throw_completion<JS::TypeError>(JS::ErrorType::ConstructorWithoutNew, "WebAssembly.Memory");
}
JS::ThrowCompletionOr<JS::Object*> WebAssemblyMemoryConstructor::construct(FunctionObject&)
@@ -35,7 +35,7 @@ JS::ThrowCompletionOr<JS::Object*> WebAssemblyMemoryConstructor::construct(Funct
auto maximum_value = TRY(descriptor->get("maximum"));
if (!initial_value.is_number())
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "Number");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "Number");
u32 initial = TRY(initial_value.to_u32(global_object));
@@ -46,10 +46,10 @@ JS::ThrowCompletionOr<JS::Object*> WebAssemblyMemoryConstructor::construct(Funct
auto address = WebAssemblyObject::s_abstract_machine.store().allocate(Wasm::MemoryType { Wasm::Limits { initial, maximum } });
if (!address.has_value())
- return vm.throw_completion<JS::TypeError>(global_object, "Wasm Memory allocation failed");
+ return vm.throw_completion<JS::TypeError>("Wasm Memory allocation failed");
if (!WebAssemblyObject::s_abstract_machine.store().get(*address)->grow(initial))
- return vm.throw_completion<JS::TypeError>(global_object, String::formatted("Wasm Memory grow failed: {}", initial));
+ return vm.throw_completion<JS::TypeError>(String::formatted("Wasm Memory grow failed: {}", initial));
return vm.heap().allocate<WebAssemblyMemoryObject>(realm, realm, *address);
}
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp
index 98e85b529d..840752a84a 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp
@@ -22,7 +22,7 @@ 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));
if (!is<WebAssemblyMemoryObject>(this_object))
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WebAssembly.Memory");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebAssembly.Memory");
auto* memory_object = static_cast<WebAssemblyMemoryObject*>(this_object);
auto address = memory_object->address();
auto* memory = WebAssemblyObject::s_abstract_machine.store().get(address);
@@ -31,7 +31,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyMemoryPrototype::grow)
auto previous_size = memory->size() / Wasm::Constants::page_size;
if (!memory->grow(page_count * Wasm::Constants::page_size))
- return vm.throw_completion<JS::TypeError>(global_object, "Memory.grow() grows past the stated limit of the memory instance");
+ return vm.throw_completion<JS::TypeError>("Memory.grow() grows past the stated limit of the memory instance");
return JS::Value(static_cast<u32>(previous_size));
}
@@ -42,7 +42,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyMemoryPrototype::buffer_getter)
auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
if (!is<WebAssemblyMemoryObject>(this_object))
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WebAssembly.Memory");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebAssembly.Memory");
auto* memory_object = static_cast<WebAssemblyMemoryObject*>(this_object);
auto address = memory_object->address();
auto* memory = WebAssemblyObject::s_abstract_machine.store().get(address);
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleConstructor.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleConstructor.cpp
index 230a78cb2d..7f6b35ea1f 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleConstructor.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleConstructor.cpp
@@ -23,7 +23,7 @@ WebAssemblyModuleConstructor::~WebAssemblyModuleConstructor() = default;
JS::ThrowCompletionOr<JS::Value> WebAssemblyModuleConstructor::call()
{
- return vm().throw_completion<JS::TypeError>(global_object(), JS::ErrorType::ConstructorWithoutNew, "WebAssembly.Module");
+ return vm().throw_completion<JS::TypeError>(JS::ErrorType::ConstructorWithoutNew, "WebAssembly.Module");
}
JS::ThrowCompletionOr<JS::Object*> WebAssemblyModuleConstructor::construct(FunctionObject&)
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp
index a2895c115b..34f4359077 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp
@@ -131,7 +131,7 @@ JS::ThrowCompletionOr<size_t> parse_module(JS::GlobalObject& global_object, JS::
auto& buffer = static_cast<JS::DataView&>(*buffer_object);
data = buffer.viewed_array_buffer()->buffer().span().slice(buffer.byte_offset(), buffer.byte_length());
} else {
- return vm.throw_completion<JS::TypeError>(global_object, "Not a BufferSource");
+ return vm.throw_completion<JS::TypeError>("Not a BufferSource");
}
InputMemoryStream stream { data };
auto module_result = Wasm::Module::parse(stream);
@@ -142,12 +142,12 @@ JS::ThrowCompletionOr<size_t> parse_module(JS::GlobalObject& global_object, JS::
};
if (module_result.is_error()) {
// FIXME: Throw CompileError instead.
- return vm.throw_completion<JS::TypeError>(global_object, Wasm::parse_error_to_string(module_result.error()));
+ return vm.throw_completion<JS::TypeError>(Wasm::parse_error_to_string(module_result.error()));
}
if (auto validation_result = WebAssemblyObject::s_abstract_machine.validate(module_result.value()); validation_result.is_error()) {
// FIXME: Throw CompileError instead.
- return vm.throw_completion<JS::TypeError>(global_object, validation_result.error().error_string);
+ return vm.throw_completion<JS::TypeError>(validation_result.error().error_string);
}
WebAssemblyObject::s_compiled_modules.append(make<WebAssemblyObject::CompiledWebAssemblyModule>(module_result.release_value()));
@@ -250,11 +250,11 @@ JS::ThrowCompletionOr<size_t> WebAssemblyObject::instantiate_module(Wasm::Module
if (import_.is_number() || import_.is_bigint()) {
if (import_.is_number() && type.type().kind() == Wasm::ValueType::I64) {
// FIXME: Throw a LinkError instead.
- return vm.throw_completion<JS::TypeError>(global_object, "LinkError: Import resolution attempted to cast a Number to a BigInteger");
+ return vm.throw_completion<JS::TypeError>("LinkError: Import resolution attempted to cast a Number to a BigInteger");
}
if (import_.is_bigint() && type.type().kind() != Wasm::ValueType::I64) {
// FIXME: Throw a LinkError instead.
- return vm.throw_completion<JS::TypeError>(global_object, "LinkError: Import resolution attempted to cast a BigInteger to a Number");
+ return vm.throw_completion<JS::TypeError>("LinkError: Import resolution attempted to cast a BigInteger to a Number");
}
auto cast_value = TRY(to_webassembly_value(global_object, import_, type.type()));
address = s_abstract_machine.store().allocate({ type.type(), false }, cast_value);
@@ -264,7 +264,7 @@ JS::ThrowCompletionOr<size_t> WebAssemblyObject::instantiate_module(Wasm::Module
// let globaladdr be v.[[Global]]
// FIXME: Throw a LinkError instead
- return vm.throw_completion<JS::TypeError>(global_object, "LinkError: Invalid value for global type");
+ return vm.throw_completion<JS::TypeError>("LinkError: Invalid value for global type");
}
resolved_imports.set(import_name, Wasm::ExternValue { *address });
@@ -273,7 +273,7 @@ JS::ThrowCompletionOr<size_t> WebAssemblyObject::instantiate_module(Wasm::Module
[&](Wasm::MemoryType const&) -> JS::ThrowCompletionOr<void> {
if (!import_.is_object() || !is<WebAssemblyMemoryObject>(import_.as_object())) {
// FIXME: Throw a LinkError instead
- return vm.throw_completion<JS::TypeError>(global_object, "LinkError: Expected an instance of WebAssembly.Memory for a memory import");
+ return vm.throw_completion<JS::TypeError>("LinkError: Expected an instance of WebAssembly.Memory for a memory import");
}
auto address = static_cast<WebAssemblyMemoryObject const&>(import_.as_object()).address();
resolved_imports.set(import_name, Wasm::ExternValue { address });
@@ -282,7 +282,7 @@ JS::ThrowCompletionOr<size_t> WebAssemblyObject::instantiate_module(Wasm::Module
[&](Wasm::TableType const&) -> JS::ThrowCompletionOr<void> {
if (!import_.is_object() || !is<WebAssemblyTableObject>(import_.as_object())) {
// FIXME: Throw a LinkError instead
- return vm.throw_completion<JS::TypeError>(global_object, "LinkError: Expected an instance of WebAssembly.Table for a table import");
+ return vm.throw_completion<JS::TypeError>("LinkError: Expected an instance of WebAssembly.Table for a table import");
}
auto address = static_cast<WebAssemblyTableObject const&>(import_.as_object()).address();
resolved_imports.set(import_name, Wasm::ExternValue { address });
@@ -291,7 +291,7 @@ JS::ThrowCompletionOr<size_t> WebAssemblyObject::instantiate_module(Wasm::Module
[&](auto const&) -> JS::ThrowCompletionOr<void> {
// FIXME: Implement these.
dbgln("Unimplemented import of non-function attempted");
- return vm.throw_completion<JS::TypeError>(global_object, "LinkError: Not Implemented");
+ return vm.throw_completion<JS::TypeError>("LinkError: Not Implemented");
}));
}
}
@@ -303,13 +303,13 @@ JS::ThrowCompletionOr<size_t> WebAssemblyObject::instantiate_module(Wasm::Module
StringBuilder builder;
builder.append("LinkError: Missing "sv);
builder.join(' ', link_result.error().missing_imports);
- return vm.throw_completion<JS::TypeError>(global_object, builder.build());
+ return vm.throw_completion<JS::TypeError>(builder.build());
}
auto instance_result = s_abstract_machine.instantiate(module, link_result.release_value());
if (instance_result.is_error()) {
// FIXME: Throw a LinkError instead.
- return vm.throw_completion<JS::TypeError>(global_object, instance_result.error().error);
+ return vm.throw_completion<JS::TypeError>(instance_result.error().error);
}
s_instantiated_modules.append(instance_result.release_value());
@@ -431,7 +431,7 @@ JS::ThrowCompletionOr<Wasm::Value> to_webassembly_value(JS::GlobalObject& global
}
}
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "Exported function");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "Exported function");
}
case Wasm::ValueType::ExternReference:
case Wasm::ValueType::NullExternReference:
@@ -465,7 +465,7 @@ JS::NativeFunction* create_native_function(JS::GlobalObject& global_object, Wasm
auto result = WebAssemblyObject::s_abstract_machine.invoke(address, move(values));
// FIXME: Use the convoluted mapping of errors defined in the spec.
if (result.is_trap())
- return vm.throw_completion<JS::TypeError>(global_object, String::formatted("Wasm execution trapped (WIP): {}", result.trap().reason));
+ return vm.throw_completion<JS::TypeError>(String::formatted("Wasm execution trapped (WIP): {}", result.trap().reason));
if (result.values().is_empty())
return JS::js_undefined();
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp
index 8adf908090..f90db4bcfe 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp
@@ -23,7 +23,7 @@ WebAssemblyTableConstructor::~WebAssemblyTableConstructor() = default;
JS::ThrowCompletionOr<JS::Value> WebAssemblyTableConstructor::call()
{
- return vm().throw_completion<JS::TypeError>(global_object(), JS::ErrorType::ConstructorWithoutNew, "WebAssembly.Table");
+ return vm().throw_completion<JS::TypeError>(JS::ErrorType::ConstructorWithoutNew, "WebAssembly.Table");
}
JS::ThrowCompletionOr<JS::Object*> WebAssemblyTableConstructor::construct(FunctionObject&)
@@ -35,7 +35,7 @@ JS::ThrowCompletionOr<JS::Object*> WebAssemblyTableConstructor::construct(Functi
auto descriptor = TRY(vm.argument(0).to_object(global_object));
auto element_value = TRY(descriptor->get("element"));
if (!element_value.is_string())
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::InvalidHint, element_value.to_string_without_side_effects());
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::InvalidHint, element_value.to_string_without_side_effects());
auto& element = element_value.as_string().string();
Optional<Wasm::ValueType> reference_type;
@@ -45,7 +45,7 @@ JS::ThrowCompletionOr<JS::Object*> WebAssemblyTableConstructor::construct(Functi
reference_type = Wasm::ValueType(Wasm::ValueType::ExternReference);
if (!reference_type.has_value())
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::InvalidHint, element);
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::InvalidHint, element);
auto initial_value = TRY(descriptor->get("initial"));
auto maximum_value = TRY(descriptor->get("maximum"));
@@ -58,7 +58,7 @@ JS::ThrowCompletionOr<JS::Object*> WebAssemblyTableConstructor::construct(Functi
maximum = TRY(maximum_value.to_u32(global_object));
if (maximum.has_value() && maximum.value() < initial)
- return vm.throw_completion<JS::RangeError>(global_object, "maximum should be larger than or equal to initial");
+ return vm.throw_completion<JS::RangeError>("maximum should be larger than or equal to initial");
auto value_value = TRY(descriptor->get("value"));
auto reference_value = TRY([&]() -> JS::ThrowCompletionOr<Wasm::Value> {
@@ -72,7 +72,7 @@ JS::ThrowCompletionOr<JS::Object*> WebAssemblyTableConstructor::construct(Functi
auto address = WebAssemblyObject::s_abstract_machine.store().allocate(Wasm::TableType { *reference_type, Wasm::Limits { initial, maximum } });
if (!address.has_value())
- return vm.throw_completion<JS::TypeError>(global_object, "Wasm Table allocation failed");
+ return vm.throw_completion<JS::TypeError>("Wasm Table allocation failed");
auto& table = *WebAssemblyObject::s_abstract_machine.store().get(*address);
for (auto& element : table.elements())
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp
index 91f7fe0bb4..ff915e5207 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp
@@ -25,7 +25,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::grow)
auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
if (!is<WebAssemblyTableObject>(this_object))
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WebAssembly.Table");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebAssembly.Table");
auto* table_object = static_cast<WebAssemblyTableObject*>(this_object);
auto address = table_object->address();
auto* table = WebAssemblyObject::s_abstract_machine.store().get(address);
@@ -44,7 +44,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::grow)
auto& reference = reference_value.value().get<Wasm::Reference>();
if (!table->grow(delta, reference))
- return vm.throw_completion<JS::RangeError>(global_object, "Failed to grow table");
+ return vm.throw_completion<JS::RangeError>("Failed to grow table");
return JS::Value(static_cast<u32>(initial_size));
}
@@ -55,7 +55,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::get)
auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
if (!is<WebAssemblyTableObject>(this_object))
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WebAssembly.Table");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebAssembly.Table");
auto* table_object = static_cast<WebAssemblyTableObject*>(this_object);
auto address = table_object->address();
auto* table = WebAssemblyObject::s_abstract_machine.store().get(address);
@@ -63,7 +63,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::get)
return JS::js_undefined();
if (table->elements().size() <= index)
- return vm.throw_completion<JS::RangeError>(global_object, "Table element index out of range");
+ return vm.throw_completion<JS::RangeError>("Table element index out of range");
auto& ref = table->elements()[index];
if (!ref.has_value())
@@ -79,7 +79,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::set)
auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
if (!is<WebAssemblyTableObject>(this_object))
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WebAssembly.Table");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebAssembly.Table");
auto* table_object = static_cast<WebAssemblyTableObject*>(this_object);
auto address = table_object->address();
auto* table = WebAssemblyObject::s_abstract_machine.store().get(address);
@@ -87,7 +87,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::set)
return JS::js_undefined();
if (table->elements().size() <= index)
- return vm.throw_completion<JS::RangeError>(global_object, "Table element index out of range");
+ return vm.throw_completion<JS::RangeError>("Table element index out of range");
auto value_value = vm.argument(1);
auto reference_value = TRY([&]() -> JS::ThrowCompletionOr<Wasm::Value> {
@@ -107,7 +107,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::length_getter)
{
auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
if (!is<WebAssemblyTableObject>(this_object))
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WebAssembly.Table");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebAssembly.Table");
auto* table_object = static_cast<WebAssemblyTableObject*>(this_object);
auto address = table_object->address();
auto* table = WebAssemblyObject::s_abstract_machine.store().get(address);
diff --git a/Userland/Libraries/LibWeb/WebGL/WebGLContextAttributes.cpp b/Userland/Libraries/LibWeb/WebGL/WebGLContextAttributes.cpp
index 648c6c565e..180a288e3c 100644
--- a/Userland/Libraries/LibWeb/WebGL/WebGLContextAttributes.cpp
+++ b/Userland/Libraries/LibWeb/WebGL/WebGLContextAttributes.cpp
@@ -16,7 +16,7 @@ JS::ThrowCompletionOr<WebGLContextAttributes> convert_value_to_context_attribute
// NOTE: This code was generated by the IDL code generator and then cleaned up.
if (!value.is_nullish() && !value.is_object())
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WebGLContextAttributes");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebGLContextAttributes");
WebGLContextAttributes context_attributes {};
@@ -109,7 +109,7 @@ JS::ThrowCompletionOr<WebGLContextAttributes> convert_value_to_context_attribute
else if (power_preference_string == "default"sv)
power_preference_value = WebGLPowerPreference::Default;
else
- return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::InvalidEnumerationValue, power_preference_string, "WebGLPowerPreference");
+ return vm.throw_completion<JS::TypeError>(JS::ErrorType::InvalidEnumerationValue, power_preference_string, "WebGLPowerPreference");
}
context_attributes.power_preference = power_preference_value;