summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-10-02 23:52:27 +0100
committerLinus Groh <mail@linusgroh.de>2021-10-03 20:14:03 +0100
commitb7e5f08e561696001d9b0ced8f3fe50caf186d2c (patch)
treedebbec2ad0557cc166acc7f5777b023b44db080e /Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp
parent9b6c09e2c4ff79714dfecb4a98222bec9cc72b71 (diff)
downloadserenity-b7e5f08e561696001d9b0ced8f3fe50caf186d2c.zip
LibJS: Convert Object::get() to ThrowCompletionOr
To no one's surprise, this patch is pretty big - this is possibly the most used AO of all of them. Definitely worth it though.
Diffstat (limited to 'Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp')
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp19
1 files changed, 5 insertions, 14 deletions
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp
index 480d2dea51..cfe8b67d05 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp
@@ -38,9 +38,7 @@ JS::Value WebAssemblyTableConstructor::construct(FunctionObject&)
if (vm.exception())
return {};
- auto element_value = descriptor->get("element");
- if (vm.exception())
- return {};
+ auto element_value = TRY_OR_DISCARD(descriptor->get("element"));
if (!element_value.is_string()) {
vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::InvalidHint, element_value.to_string_without_side_effects());
return {};
@@ -58,12 +56,8 @@ JS::Value WebAssemblyTableConstructor::construct(FunctionObject&)
return {};
}
- auto initial_value = descriptor->get("initial");
- if (vm.exception())
- return {};
- auto maximum_value = descriptor->get("maximum");
- if (vm.exception())
- return {};
+ auto initial_value = TRY_OR_DISCARD(descriptor->get("initial"));
+ auto maximum_value = TRY_OR_DISCARD(descriptor->get("maximum"));
auto initial = initial_value.to_u32(global_object);
if (vm.exception())
@@ -82,12 +76,9 @@ JS::Value WebAssemblyTableConstructor::construct(FunctionObject&)
return {};
}
- auto value_value = descriptor->get("value");
- if (vm.exception())
- return {};
-
+ auto value_value = TRY_OR_DISCARD(descriptor->get("value"));
auto reference_value = [&]() -> Optional<Wasm::Value> {
- if (value_value.is_empty() || value_value.is_undefined())
+ if (value_value.is_undefined())
return Wasm::Value(*reference_type, 0ull);
return to_webassembly_value(value_value, *reference_type, global_object);