1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 10:57:36 +00:00

LibJS: Guard IntegerIndexedElementSet with receiver check

This is a normative change in the ECMA-262 spec. See:
3620f11
This commit is contained in:
Timothy Flynn 2022-08-25 13:50:58 -04:00 committed by Linus Groh
parent a803d9226f
commit 6309b8773d
2 changed files with 42 additions and 4 deletions

View file

@ -331,11 +331,18 @@ public:
auto numeric_index = canonical_numeric_index_string(property_key, CanonicalIndexMode::DetectNumericRoundtrip);
// b. If numericIndex is not undefined, then
if (!numeric_index.is_undefined()) {
// i. Perform ? IntegerIndexedElementSet(O, numericIndex, V).
TRY(integer_indexed_element_set<T>(*this, numeric_index, value));
// i. If SameValue(O, Receiver) is true, then
if (same_value(this, receiver)) {
// 1. Perform ? IntegerIndexedElementSet(O, numericIndex, V).
TRY(integer_indexed_element_set<T>(*this, numeric_index, value));
// ii. Return true.
return true;
// 2. Return true.
return true;
}
// ii. If IsValidIntegerIndex(O, numericIndex) is false, return true.
if (!is_valid_integer_index(*this, numeric_index))
return true;
}
}