1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-28 16:42:12 +00:00

LibJS: Convert enumerable_own_property_names() to ThrowCompletionOr

This commit is contained in:
Linus Groh 2021-10-03 02:25:28 +01:00
parent 3af559ee8a
commit e5b8544762
6 changed files with 14 additions and 37 deletions

View file

@ -238,9 +238,7 @@ String JSONObject::serialize_json_object(GlobalObject& global_object, StringifyS
return {};
}
} else {
auto property_list = object.enumerable_own_property_names(PropertyKind::Key);
if (vm.exception())
return {};
auto property_list = TRY_OR_DISCARD(object.enumerable_own_property_names(PropertyKind::Key));
for (auto& property : property_list) {
process_property(property.as_string().string());
if (vm.exception())
@ -480,9 +478,7 @@ Value JSONObject::internalize_json_property(GlobalObject& global_object, Object*
for (size_t i = 0; i < length; ++i)
TRY_OR_DISCARD(process_property(i));
} else {
auto property_list = value_object.enumerable_own_property_names(Object::PropertyKind::Key);
if (vm.exception())
return {};
auto property_list = TRY_OR_DISCARD(value_object.enumerable_own_property_names(Object::PropertyKind::Key));
for (auto& property_name : property_list)
TRY_OR_DISCARD(process_property(property_name.as_string().string()));
}