summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-04-25 22:40:21 +0200
committerLinus Groh <mail@linusgroh.de>2021-04-25 22:40:21 +0200
commitc61de8e4bee2135c83c1e515dc5444f3ae41dcd7 (patch)
treea2a28f953b9f0f3759f92e5dc35c9717513e61d8 /Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp
parentaf62678c3112aaee45b1bfeeeacf5386b33e4e46 (diff)
downloadserenity-c61de8e4bee2135c83c1e515dc5444f3ae41dcd7.zip
LibJS: Use Object::get_own_properties() for getOwnPropertyNames()
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp')
-rw-r--r--Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp11
1 files changed, 1 insertions, 10 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp
index 55cecc5e27..5c1caabfa2 100644
--- a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp
+++ b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp
@@ -71,16 +71,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_own_property_names)
auto* object = vm.argument(0).to_object(global_object);
if (vm.exception())
return {};
- auto* result = Array::create(global_object);
- 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;
+ return Array::create_from(global_object, object->get_own_properties(PropertyKind::Key, false, GetOwnPropertyReturnType::StringOnly));
}
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_prototype_of)