1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-21 15:55:07 +00:00

LibJS: Add property configuration transitions

Object.defineProperty() can now change the attributes of a property
already on the object. Internally this becomes a shape transition with
the TransitionType::Configure. Such transitions don't expand the
property storage capacity, but rather simply keep attributes up to date
when generating a property table.
This commit is contained in:
Andreas Kling 2020-04-09 22:55:17 +02:00
parent e6d920d87d
commit 8286f8b996
5 changed files with 57 additions and 8 deletions

View file

@ -127,7 +127,7 @@ Value ObjectConstructor::define_property(Interpreter& interpreter)
auto& object = interpreter.argument(0).as_object();
auto& descriptor = interpreter.argument(2).as_object();
Value value = descriptor.get("value").value_or(js_undefined());
Value value = descriptor.get("value").value_or(Value());
u8 configurable = descriptor.get("configurable").value_or(Value(false)).to_boolean() * Attribute::Configurable;
u8 enumerable = descriptor.get("enumerable").value_or(Value(false)).to_boolean() * Attribute::Enumerable;
u8 writable = descriptor.get("writable").value_or(Value(false)).to_boolean() * Attribute::Writable;