1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 19:55:06 +00:00

LibJS: Implement correct attributes for (almost) all properties

Added the ability to include a u8 attributes parameter with all of the
various put methods in the Object class. They can be omitted, in which
case it defaults to "Writable | Enumerable | Configurable", just like
before this commit.

All of the attribute values for each property were gathered from
SpiderMonkey in the Firefox console. Some properties (e.g. all of the
canvas element properties) have undefined property descriptors... not
quite sure what that means. Those were left as the default specified
above.
This commit is contained in:
mattco98 2020-04-27 23:05:02 -07:00 committed by Andreas Kling
parent c4d05049c4
commit 23ec578a01
26 changed files with 189 additions and 169 deletions

View file

@ -46,8 +46,8 @@ ScriptFunction::ScriptFunction(const FlyString& name, const Statement& body, Vec
, m_parameters(move(parameters))
, m_parent_environment(parent_environment)
{
put("prototype", Object::create_empty(interpreter(), interpreter().global_object()));
put_native_property("length", length_getter, length_setter);
put("prototype", Object::create_empty(interpreter(), interpreter().global_object()), 0);
put_native_property("length", length_getter, length_setter, Attribute::Configurable);
}
ScriptFunction::~ScriptFunction()