LibJS: Use ToPropertyKey in Object.getOwnPropertyDescriptor

The specification requires this. (And the current usage of
PropertyName::from_value is invalid since integers are not allowed in
this context)
This commit is contained in:
Idan Horowitz 2021-06-07 16:54:04 +03:00 committed by Linus Groh
parent 1c51edb639
commit f9395efaac
Notes: sideshowbarker 2024-07-18 12:42:55 +09:00

View File

@ -190,7 +190,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_own_property_descriptor)
auto* object = vm.argument(0).to_object(global_object);
if (vm.exception())
return {};
auto property_key = PropertyName::from_value(global_object, vm.argument(1));
auto property_key = vm.argument(1).to_property_key(global_object);
if (vm.exception())
return {};
return object->get_own_property_descriptor_object(property_key);