LibJS: Do not store iterated values in a plain vector
This commit is contained in:
parent
9949173fce
commit
108b4e7c15
Notes:
github-actions[bot]
2024-10-31 23:36:59 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/108b4e7c15f Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2088
1 changed files with 2 additions and 2 deletions
|
@ -717,7 +717,7 @@ JS_DEFINE_NATIVE_FUNCTION(IteratorPrototype::to_array)
|
|||
auto iterated = TRY(get_iterator_direct(vm, object));
|
||||
|
||||
// 4. Let items be a new empty List.
|
||||
Vector<Value> items;
|
||||
MarkedVector<Value> items(realm.heap());
|
||||
|
||||
// 5. Repeat,
|
||||
while (true) {
|
||||
|
@ -729,7 +729,7 @@ JS_DEFINE_NATIVE_FUNCTION(IteratorPrototype::to_array)
|
|||
return Array::create_from(realm, items);
|
||||
|
||||
// c. Append value to items.
|
||||
TRY_OR_THROW_OOM(vm, items.try_append(*value));
|
||||
items.append(*value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue