1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:07:45 +00:00

LibWeb: Convert the Window object to ThrowCompletionOr

This commit is contained in:
Timothy Flynn 2021-10-31 08:31:43 -04:00 committed by Linus Groh
parent 585e420707
commit 85dc3a8099
3 changed files with 222 additions and 332 deletions

View file

@ -6,12 +6,10 @@
#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())) { \
vm.throw_exception<JS::TypeError>(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 })); \
#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 })); \
return JS::js_undefined();