summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp')
-rw-r--r--Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp
index fddded47f1..17f2a3fcb2 100644
--- a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp
+++ b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp
@@ -202,14 +202,14 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::define_property_)
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObject, "Object argument");
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::NotAnObject, "Descriptor argument");
return {};
}
auto& object = vm.argument(0).as_object();
- auto property_key = StringOrSymbol::from_value(global_object, vm.argument(1));
- if (vm.exception())
- return {};
auto& descriptor = vm.argument(2).as_object();
if (!object.define_property(property_key, descriptor)) {
if (!vm.exception()) {
@@ -316,10 +316,10 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::has_own)
auto* object = vm.argument(0).to_object(global_object);
if (vm.exception())
return {};
- auto string_or_symbol = StringOrSymbol::from_value(global_object, vm.argument(1));
+ auto property_key = vm.argument(1).to_property_key(global_object);
if (vm.exception())
return {};
- return Value(object->has_own_property(string_or_symbol));
+ return Value(object->has_own_property(property_key));
}
}