mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
LibJS: Skip trailing empty values in IndexedPropertyIterator
When we reach the end of the pre-computed indices vector we can just skip to the end (array-like size) as only empty values will follow. Fixes #3970.
This commit is contained in:
parent
d5bb5d109b
commit
021c8dea1f
Notes:
sideshowbarker
2024-07-19 01:32:27 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/021c8dea1fc Pull-request: https://github.com/SerenityOS/serenity/pull/3972 Issue: https://github.com/SerenityOS/serenity/issues/3970
1 changed files with 2 additions and 5 deletions
|
@ -264,16 +264,13 @@ ValueAndAttributes IndexedPropertyIterator::value_and_attributes(Object* this_ob
|
|||
void IndexedPropertyIterator::skip_empty_indices()
|
||||
{
|
||||
auto indices = m_indexed_properties.indices();
|
||||
if (indices.is_empty()) {
|
||||
m_index = m_indexed_properties.array_like_size();
|
||||
return;
|
||||
}
|
||||
for (auto i : indices) {
|
||||
if (i < m_index)
|
||||
continue;
|
||||
m_index = i;
|
||||
break;
|
||||
return;
|
||||
}
|
||||
m_index = m_indexed_properties.array_like_size();
|
||||
}
|
||||
|
||||
Optional<ValueAndAttributes> IndexedProperties::get(Object* this_object, u32 index, bool evaluate_accessors) const
|
||||
|
|
Loading…
Add table
Reference in a new issue