summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-06-05 15:22:11 +0300
committerLinus Groh <mail@linusgroh.de>2021-06-05 14:15:28 +0100
commiteb0b1c432a0e9aa5a220c460e95694dd3fbb67b8 (patch)
treea5aab6675ee19faa4a909c40dc6c34dac67700d3 /Userland/Libraries/LibJS/Runtime/ReflectObject.cpp
parente72e621d89fee1d368f294eb239fa4fe54a1b5f2 (diff)
downloadserenity-eb0b1c432a0e9aa5a220c460e95694dd3fbb67b8.zip
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.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/ReflectObject.cpp')
-rw-r--r--Userland/Libraries/LibJS/Runtime/ReflectObject.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp b/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp
index 1dfd68d14f..3e7f911db6 100644
--- a/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp
+++ b/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp
@@ -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())