summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-10-31 16:56:21 +0200
committerIdan Horowitz <idan.horowitz@gmail.com>2021-10-31 18:20:37 +0200
commitc7c914800c67754e4187f4ae0b848a1afd16ac63 (patch)
treec392fdbe9d18dfd07ea668cf20afe40034405b8c /Userland/Libraries/LibWeb
parenta8d39bc0707ffa23d4eaf476767bf891201d4056 (diff)
downloadserenity-c7c914800c67754e4187f4ae0b848a1afd16ac63.zip
LibWeb: Convert WebAssemblyInstancePrototype funcs to ThrowCompletionOr
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp12
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.h2
2 files changed, 6 insertions, 8 deletions
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp
index 4688a4b256..1f05165f9d 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp
@@ -13,17 +13,15 @@ namespace Web::Bindings {
void WebAssemblyInstancePrototype::initialize(JS::GlobalObject& global_object)
{
Object::initialize(global_object);
- define_old_native_accessor("exports", exports_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
+ define_native_accessor("exports", exports_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
}
-JS_DEFINE_OLD_NATIVE_FUNCTION(WebAssemblyInstancePrototype::exports_getter)
+JS_DEFINE_NATIVE_FUNCTION(WebAssemblyInstancePrototype::exports_getter)
{
auto this_value = vm.this_value(global_object);
- auto* this_object = TRY_OR_DISCARD(this_value.to_object(global_object));
- if (!is<WebAssemblyInstanceObject>(this_object)) {
- vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WebAssembly.Instance");
- return {};
- }
+ 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");
auto object = static_cast<WebAssemblyInstanceObject*>(this_object);
return object->m_exports_object;
}
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.h b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.h
index 4417787135..fff25310e1 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.h
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.h
@@ -25,7 +25,7 @@ public:
virtual void initialize(JS::GlobalObject&) override;
private:
- JS_DECLARE_OLD_NATIVE_FUNCTION(exports_getter);
+ JS_DECLARE_NATIVE_FUNCTION(exports_getter);
static JS::Handle<WebAssemblyInstancePrototype> s_instance;
};