mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:07:46 +00:00
LibJS: Use Object::get_own_properties() for getOwnPropertyNames()
This commit is contained in:
parent
af62678c31
commit
c61de8e4be
1 changed files with 1 additions and 10 deletions
|
@ -71,16 +71,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_own_property_names)
|
||||||
auto* object = vm.argument(0).to_object(global_object);
|
auto* object = vm.argument(0).to_object(global_object);
|
||||||
if (vm.exception())
|
if (vm.exception())
|
||||||
return {};
|
return {};
|
||||||
auto* result = Array::create(global_object);
|
return Array::create_from(global_object, object->get_own_properties(PropertyKind::Key, false, GetOwnPropertyReturnType::StringOnly));
|
||||||
for (auto& entry : object->indexed_properties())
|
|
||||||
result->indexed_properties().append(js_string(vm, String::number(entry.index())));
|
|
||||||
for (auto& it : object->shape().property_table_ordered()) {
|
|
||||||
if (!it.key.is_string())
|
|
||||||
continue;
|
|
||||||
result->indexed_properties().append(js_string(vm, it.key.as_string()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_prototype_of)
|
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_prototype_of)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue