1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:47:47 +00:00

LibJS: Make Object.getOwnPropertyDescriptor() work on String subscripts

String objects are a bit special since the indexed properties are
overridden by the contents of the underlying PrimitiveString.

getOwnPropertyDescriptor() was not taking this into account, and would
instead return undefined when asked about an indexed property in a
String object.
This commit is contained in:
Andreas Kling 2021-06-19 11:34:19 +02:00
parent 25baefdd1e
commit 686213c2b8
3 changed files with 24 additions and 0 deletions

View file

@ -29,6 +29,7 @@ public:
private:
virtual bool is_string_object() const final { return true; }
virtual void visit_edges(Visitor&) override;
virtual Optional<PropertyDescriptor> get_own_property_descriptor(PropertyName const&) const override;
PrimitiveString& m_string;
};