summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2021-09-11 15:28:51 -0400
committerAndreas Kling <kling@serenityos.org>2021-09-12 00:16:39 +0200
commitc59b97043eaf72cdb757262354ddb34b79b127d2 (patch)
tree7707133c78319d05e37b596fa539d22ae4f9a7cf
parentfd8ec1fffa587913e3079a2964c1d4a5076b2158 (diff)
downloadserenity-c59b97043eaf72cdb757262354ddb34b79b127d2.zip
LibWeb: Use ErrorType::NotAnObjectOfType instead of NotA
-rw-r--r--Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp10
-rw-r--r--Tests/LibWeb/test-web.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Bindings/WindowObject.cpp4
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.cpp2
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp2
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp2
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp4
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp2
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp8
9 files changed, 19 insertions, 19 deletions
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp
index 2e68cf201a..13c4f0da66 100644
--- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp
+++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp
@@ -579,7 +579,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
RefPtr<EventListener> @cpp_name@;
if (!@js_name@@js_suffix@.is_nullish()) {
if (!@js_name@@js_suffix@.is_function()) {
- vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotA, "Function");
+ vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "Function");
@return_statement@
}
@cpp_name@ = adopt_ref(*new EventListener(JS::make_handle(&@js_name@@js_suffix@.as_function())));
@@ -588,7 +588,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
} else {
scoped_generator.append(R"~~~(
if (!@js_name@@js_suffix@.is_function()) {
- vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotA, "Function");
+ vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "Function");
@return_statement@
}
auto @cpp_name@ = adopt_ref(*new EventListener(JS::make_handle(&@js_name@@js_suffix@.as_function())));
@@ -602,7 +602,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
@return_statement@
if (!is<@parameter.type.name@Wrapper>(@cpp_name@_object)) {
- vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotA, "@parameter.type.name@");
+ vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "@parameter.type.name@");
@return_statement@
}
@@ -617,7 +617,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
@return_statement@
if (!is<@parameter.type.name@Wrapper>(@cpp_name@_object)) {
- vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotA, "@parameter.type.name@");
+ vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "@parameter.type.name@");
@return_statement@
}
@@ -1568,7 +1568,7 @@ static @fully_qualified_name@* impl_from(JS::VM& vm, JS::GlobalObject& global_ob
generator.append(R"~~~(
if (!is<@wrapper_class@>(this_object)) {
- vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotA, "@fully_qualified_name@");
+ vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "@fully_qualified_name@");
return nullptr;
}
diff --git a/Tests/LibWeb/test-web.cpp b/Tests/LibWeb/test-web.cpp
index 958c66dceb..bee86f911d 100644
--- a/Tests/LibWeb/test-web.cpp
+++ b/Tests/LibWeb/test-web.cpp
@@ -61,7 +61,7 @@ TESTJS_GLOBAL_FUNCTION(after_initial_page_load, afterInitialPageLoad)
auto function = vm.argument(0);
if (!function.is_function()) {
dbgln("afterInitialPageLoad argument is not a function");
- vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotA, "Function");
+ vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "Function");
return {};
}
@@ -76,7 +76,7 @@ TESTJS_GLOBAL_FUNCTION(before_initial_page_load, beforeInitialPageLoad)
auto function = vm.argument(0);
if (!function.is_function()) {
dbgln("beforeInitialPageLoad argument is not a function");
- vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotA, "Function");
+ vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "Function");
return {};
}
diff --git a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp
index 12e53f949a..c6c764651f 100644
--- a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp
@@ -133,7 +133,7 @@ static DOM::Window* impl_from(JS::VM& vm, JS::GlobalObject& global_object)
VERIFY(this_object);
if (StringView("WindowObject") != this_object->class_name()) {
- vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotA, "WindowObject");
+ vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WindowObject");
return nullptr;
}
return &static_cast<WindowObject*>(this_object)->impl();
@@ -463,7 +463,7 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::get_computed_style)
return {};
if (!is<ElementWrapper>(object)) {
- vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotA, "DOM element");
+ vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "DOM element");
return {};
}
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.cpp
index 94953c0342..770249be7f 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.cpp
@@ -39,7 +39,7 @@ JS::Value WebAssemblyInstanceConstructor::construct(FunctionObject&)
return {};
if (!is<WebAssemblyModuleObject>(module_argument)) {
- vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotA, "WebAssembly.Module");
+ vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WebAssembly.Module");
return {};
}
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp
index 8b37f813de..924a6c1102 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp
@@ -23,7 +23,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyInstancePrototype::exports_getter)
if (vm.exception())
return {};
if (!is<WebAssemblyInstanceObject>(this_object)) {
- vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotA, "WebAssembly.Instance");
+ vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WebAssembly.Instance");
return {};
}
auto object = static_cast<WebAssemblyInstanceObject*>(this_object);
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp
index 338dbcc959..deb27bd3bf 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp
@@ -40,7 +40,7 @@ JS::Value WebAssemblyMemoryConstructor::construct(FunctionObject&)
auto maximum_value = descriptor->get_without_side_effects("maximum");
if (initial_value.is_empty()) {
- vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotA, "Number");
+ vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "Number");
return {};
}
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp
index 0655cdcc3a..1033bb8268 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp
@@ -24,7 +24,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyMemoryPrototype::grow)
return {};
auto* this_object = vm.this_value(global_object).to_object(global_object);
if (!this_object || !is<WebAssemblyMemoryObject>(this_object)) {
- vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotA, "WebAssembly.Memory");
+ vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WebAssembly.Memory");
return {};
}
auto* memory_object = static_cast<WebAssemblyMemoryObject*>(this_object);
@@ -46,7 +46,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyMemoryPrototype::buffer_getter)
{
auto* this_object = vm.this_value(global_object).to_object(global_object);
if (!this_object || !is<WebAssemblyMemoryObject>(this_object)) {
- vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotA, "WebAssembly.Memory");
+ vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WebAssembly.Memory");
return {};
}
auto* memory_object = static_cast<WebAssemblyMemoryObject*>(this_object);
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp
index aabe0d27c6..1f1459ef9a 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp
@@ -428,7 +428,7 @@ Optional<Wasm::Value> to_webassembly_value(JS::Value value, const Wasm::ValueTyp
}
}
- vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAn, "Exported function");
+ vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "Exported function");
return {};
}
case Wasm::ValueType::ExternReference:
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp
index 161d413fdf..614c132228 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp
@@ -26,7 +26,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::grow)
return {};
auto* this_object = vm.this_value(global_object).to_object(global_object);
if (!this_object || !is<WebAssemblyTableObject>(this_object)) {
- vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotA, "WebAssembly.Table");
+ vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WebAssembly.Table");
return {};
}
auto* table_object = static_cast<WebAssemblyTableObject*>(this_object);
@@ -65,7 +65,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::get)
auto* this_object = vm.this_value(global_object).to_object(global_object);
if (!this_object || !is<WebAssemblyTableObject>(this_object)) {
- vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotA, "WebAssembly.Table");
+ vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WebAssembly.Table");
return {};
}
auto* table_object = static_cast<WebAssemblyTableObject*>(this_object);
@@ -95,7 +95,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::set)
auto* this_object = vm.this_value(global_object).to_object(global_object);
if (!this_object || !is<WebAssemblyTableObject>(this_object)) {
- vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotA, "WebAssembly.Table");
+ vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WebAssembly.Table");
return {};
}
auto* table_object = static_cast<WebAssemblyTableObject*>(this_object);
@@ -130,7 +130,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::length_getter)
{
auto* this_object = vm.this_value(global_object).to_object(global_object);
if (!this_object || !is<WebAssemblyTableObject>(this_object)) {
- vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotA, "WebAssembly.Table");
+ vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WebAssembly.Table");
return {};
}
auto* table_object = static_cast<WebAssemblyTableObject*>(this_object);