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

LibJS: Let set_array_like_size() switch to generic storage if necessary

This is already considered in put()/insert()/append_all() but not
set_array_like_size(), which crashed the interpreter with an assertion
when creating an array with more than SPARSE_ARRAY_THRESHOLD (200)
initial elements as the simple storage was being resized beyond its
limit.

Fixes #3382.
This commit is contained in:
Linus Groh 2020-09-01 19:45:29 +01:00 committed by Andreas Kling
parent 28ff8f3376
commit ae9d64e544
2 changed files with 8 additions and 1 deletions

View file

@ -162,7 +162,7 @@ public:
size_t size() const { return m_storage->size(); }
bool is_empty() const { return size() == 0; }
size_t array_like_size() const { return m_storage->array_like_size(); }
void set_array_like_size(size_t new_size) { m_storage->set_array_like_size(new_size); };
void set_array_like_size(size_t);
Vector<ValueAndAttributes> values_unordered() const;