diff options
author | Andreas Kling <kling@serenityos.org> | 2021-06-19 11:34:19 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-19 11:34:19 +0200 |
commit | 686213c2b81f408addca928ef1508e2af0354f9c (patch) | |
tree | 13fd399302c071634fda5e8f8559005c0f99e8e0 /Userland/Libraries/LibJS/Runtime/StringObject.h | |
parent | 25baefdd1e7c8efefd4ddf5cb2af363b4e9ebd22 (diff) | |
download | serenity-686213c2b81f408addca928ef1508e2af0354f9c.zip |
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.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/StringObject.h')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/StringObject.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/StringObject.h b/Userland/Libraries/LibJS/Runtime/StringObject.h index 8c7ee5cc94..3f74ec8769 100644 --- a/Userland/Libraries/LibJS/Runtime/StringObject.h +++ b/Userland/Libraries/LibJS/Runtime/StringObject.h @@ -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; }; |