mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:47:34 +00:00
LibJS: Replace StringOrSymbol::from_value with Value::to_property_key
This is a more specification compliant implementation of the abstract operation 7.1.19 ToPropertyKey which should handle boxed symbols correctly.
This commit is contained in:
parent
e72e621d89
commit
eb0b1c432a
8 changed files with 29 additions and 29 deletions
|
@ -124,13 +124,13 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::define_property)
|
|||
auto* target = get_target_object_from(global_object, "defineProperty");
|
||||
if (!target)
|
||||
return {};
|
||||
auto property_key = vm.argument(1).to_property_key(global_object);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
if (!vm.argument(2).is_object()) {
|
||||
vm.throw_exception<TypeError>(global_object, ErrorType::ReflectBadDescriptorArgument);
|
||||
return {};
|
||||
}
|
||||
auto property_key = StringOrSymbol::from_value(global_object, vm.argument(1));
|
||||
if (vm.exception())
|
||||
return {};
|
||||
auto& descriptor = vm.argument(2).as_object();
|
||||
auto success = target->define_property(property_key, descriptor, false);
|
||||
if (vm.exception())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue