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

LibJS: Stop propagating small OOM errors from the String object

This commit is contained in:
Timothy Flynn 2023-09-06 07:40:44 -04:00 committed by Tim Flynn
parent 02a8683266
commit d1a1ace77a
4 changed files with 51 additions and 53 deletions

View file

@ -150,14 +150,14 @@ ThrowCompletionOr<MarkedVector<Value>> StringObject::internal_own_property_keys(
// 5. For each integer i starting with 0 such that i < len, in ascending order, do
for (size_t i = 0; i < length; ++i) {
// a. Add ! ToString(𝔽(i)) as the last element of keys.
keys.append(PrimitiveString::create(vm, TRY_OR_THROW_OOM(vm, String::number(i))));
keys.append(PrimitiveString::create(vm, MUST(String::number(i))));
}
// 6. For each own property key P of O such that P is an array index and ! ToIntegerOrInfinity(P) ≥ len, in ascending numeric index order, do
for (auto& entry : indexed_properties()) {
if (entry.index() >= length) {
// a. Add P as the last element of keys.
keys.append(PrimitiveString::create(vm, TRY_OR_THROW_OOM(vm, String::number(entry.index()))));
keys.append(PrimitiveString::create(vm, MUST(String::number(entry.index()))));
}
}