1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 17:28:11 +00:00

LibJS: Add define_direct_property and remove the define_property helper

This removes all usages of the non-standard define_property helper
method and replaces all it's usages with the specification required
alternative or with define_direct_property where appropriate.
This commit is contained in:
Idan Horowitz 2021-07-06 02:15:08 +03:00 committed by Linus Groh
parent e915155ca4
commit a6b8291a9b
81 changed files with 246 additions and 275 deletions

View file

@ -28,9 +28,9 @@ void ObjectConstructor::initialize(GlobalObject& global_object)
NativeFunction::initialize(global_object);
// 20.1.2.19 Object.prototype, https://tc39.es/ecma262/#sec-object.prototype
define_property(vm.names.prototype, global_object.object_prototype(), 0);
define_direct_property(vm.names.prototype, global_object.object_prototype(), 0);
define_property(vm.names.length, Value(1), Attribute::Configurable);
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
u8 attr = Attribute::Writable | Attribute::Configurable;
define_native_function(vm.names.defineProperty, define_property_, 3, attr);
@ -263,7 +263,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::from_entries)
auto property_key = key.to_property_key(global_object);
if (vm.exception())
return IterationDecision::Break;
object->define_property(property_key, value);
object->create_data_property_or_throw(property_key, value);
if (vm.exception())
return IterationDecision::Break;
return IterationDecision::Continue;