mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:57:45 +00:00
LibJS: Only do a single property lookup in internal_get_own_property()
Instead of checking storage_has(), followed by storage_get(), we can do storage_get() directly and avoid a redundant property lookup. This exposed a bug in SimpleIndexedPropertyStorage::get() which would previously succeed for array holes.
This commit is contained in:
parent
8074bdc049
commit
6108bac606
2 changed files with 4 additions and 3 deletions
|
@ -26,7 +26,7 @@ bool SimpleIndexedPropertyStorage::has_index(u32 index) const
|
|||
|
||||
Optional<ValueAndAttributes> SimpleIndexedPropertyStorage::get(u32 index) const
|
||||
{
|
||||
if (index >= m_array_size)
|
||||
if (!has_index(index))
|
||||
return {};
|
||||
return ValueAndAttributes { m_packed_elements[index], default_attributes };
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue