mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
LibJS: Use array-like size for IndexedProperties::is_empty()
Some things, like (the non-generic version of) Array.prototype.pop(), check is_empty() to determine whether an action, like removing elements, can be performed. We need to know the array-like size for that, not the size of the underlying storage, which can be different - and is not something IndexedProperties should expose so I removed its size(). Fixes #3948.
This commit is contained in:
parent
0bb66890c8
commit
dec6c0a207
Notes:
sideshowbarker
2024-07-19 01:32:45 +09:00
Author: https://github.com/linusg
Commit: dec6c0a207
Pull-request: https://github.com/SerenityOS/serenity/pull/3956
Issue: https://github.com/SerenityOS/serenity/issues/3948
2 changed files with 7 additions and 2 deletions
|
@ -161,8 +161,7 @@ public:
|
|||
IndexedPropertyIterator begin(bool skip_empty = true) const { return IndexedPropertyIterator(*this, 0, skip_empty); };
|
||||
IndexedPropertyIterator end() const { return IndexedPropertyIterator(*this, array_like_size(), false); };
|
||||
|
||||
size_t size() const { return m_storage->size(); }
|
||||
bool is_empty() const { return size() == 0; }
|
||||
bool is_empty() const { return array_like_size() == 0; }
|
||||
size_t array_like_size() const { return m_storage->array_like_size(); }
|
||||
void set_array_like_size(size_t);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue