From 5da210125e1ae62278ddf708ad85b037f1891a81 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Wed, 29 Sep 2021 17:54:25 +0100 Subject: LibJS: Convert internal_define_own_property() to ThrowCompletionOr --- Userland/Libraries/LibWeb/Bindings/Replaceable.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'Userland/Libraries/LibWeb/Bindings') diff --git a/Userland/Libraries/LibWeb/Bindings/Replaceable.h b/Userland/Libraries/LibWeb/Bindings/Replaceable.h index 6617922fe9..fce41f813c 100644 --- a/Userland/Libraries/LibWeb/Bindings/Replaceable.h +++ b/Userland/Libraries/LibWeb/Bindings/Replaceable.h @@ -6,11 +6,12 @@ #pragma once -#define REPLACEABLE_PROPERTY_SETTER(ObjectType, property) \ - auto this_value = vm.this_value(global_object); \ - if (!this_value.is_object() || !is(this_value.as_object())) { \ - vm.throw_exception(global_object, JS::ErrorType::NotAnObjectOfType, #ObjectType); \ - return {}; \ - } \ - 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(this_value.as_object())) { \ + vm.throw_exception(global_object, JS::ErrorType::NotAnObjectOfType, #ObjectType); \ + return {}; \ + } \ + TRY_OR_DISCARD(this_value.as_object().internal_define_own_property( \ + #property, JS::PropertyDescriptor { .value = vm.argument(0), .writable = true })); \ return JS::js_undefined(); -- cgit v1.2.3