1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:58:11 +00:00

LibJS: Add Object::get_enumerable_own_property_names() and use it

Object::get_own_properties() is a bit unwieldy to use - especially as
StringOnly is about to no longer be the default value. The spec has an
abstract operation specifically for this (EnumerateObjectProperties),
so let's use that. No functionality change.
This commit is contained in:
Linus Groh 2021-04-05 19:05:15 +02:00 committed by Andreas Kling
parent afc86abe24
commit 1416027486
4 changed files with 13 additions and 4 deletions

View file

@ -209,7 +209,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::keys)
if (vm.exception())
return {};
return obj_arg->get_own_properties(PropertyKind::Key, true);
return obj_arg->get_enumerable_own_property_names(PropertyKind::Key);
}
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::values)
@ -222,7 +222,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::values)
if (vm.exception())
return {};
return obj_arg->get_own_properties(PropertyKind::Value, true);
return obj_arg->get_enumerable_own_property_names(PropertyKind::Value);
}
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::entries)
@ -235,7 +235,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::entries)
if (vm.exception())
return {};
return obj_arg->get_own_properties(PropertyKind::KeyAndValue, true);
return obj_arg->get_enumerable_own_property_names(PropertyKind::KeyAndValue);
}
}