mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:17:44 +00:00
LibJS: Stop using a native property for Array lengths
Specifically, replace it with a specification-based implementation that overrides the internal methods that interact with the length property instead.
This commit is contained in:
parent
fff112c8a3
commit
c351b4ad0d
5 changed files with 222 additions and 67 deletions
|
@ -18,14 +18,19 @@ public:
|
|||
static Array* create_from(GlobalObject&, Vector<Value> const&);
|
||||
|
||||
explicit Array(Object& prototype);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual ~Array() override;
|
||||
|
||||
static Array* typed_this(VM&, GlobalObject&);
|
||||
virtual Optional<PropertyDescriptor> internal_get_own_property(PropertyName const&) const override;
|
||||
virtual bool internal_define_own_property(PropertyName const&, PropertyDescriptor const&) override;
|
||||
virtual bool internal_delete(PropertyName const&) override;
|
||||
virtual MarkedValueList internal_own_property_keys() const override;
|
||||
|
||||
[[nodiscard]] bool length_is_writable() const { return m_length_writable; };
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_GETTER(length_getter);
|
||||
JS_DECLARE_NATIVE_SETTER(length_setter);
|
||||
bool set_length(PropertyDescriptor const&);
|
||||
|
||||
bool m_length_writable { true };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue