mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:24:57 +00:00
LibJS: Update spec notes for a resizable ArrayBuffer workaround
This is a normative change in the ECMA-262 spec. See:
22de374
The issue noted here has been fixed in the same way that we previously
worked around it. Update the spec notes to match.
This commit is contained in:
parent
7566ff90ee
commit
75262a92e1
1 changed files with 7 additions and 8 deletions
|
@ -1616,14 +1616,13 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::slice)
|
|||
// d. Set final to min(final, len).
|
||||
final = min(final, length);
|
||||
|
||||
// FIXME: Spec issue: If the TypedArray length changed, the count must also be updated.
|
||||
// https://github.com/tc39/ecma262/issues/3248
|
||||
// e. Set count to max(final - k, 0).
|
||||
count = max(final - k, 0);
|
||||
|
||||
// e. Let srcType be TypedArrayElementType(O).
|
||||
// f. Let targetType be TypedArrayElementType(A).
|
||||
// f. Let srcType be TypedArrayElementType(O).
|
||||
// g. Let targetType be TypedArrayElementType(A).
|
||||
|
||||
// g. If srcType is targetType, then
|
||||
// h. If srcType is targetType, then
|
||||
if (typed_array->element_name() == array->element_name()) {
|
||||
// i. NOTE: The transfer must be performed in a manner that preserves the bit-level encoding of the source data.
|
||||
|
||||
|
@ -1651,8 +1650,8 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::slice)
|
|||
// vii. Let targetByteIndex be A.[[ByteOffset]].
|
||||
auto target_byte_index = array->byte_offset();
|
||||
|
||||
// viii. Let limit be targetByteIndex + min(count, len) × elementSize.
|
||||
Checked<u32> limit = min(count, length);
|
||||
// viii. Let limit be targetByteIndex + (count × elementSize).
|
||||
Checked<u32> limit = count;
|
||||
limit *= element_size;
|
||||
limit += target_byte_index;
|
||||
if (limit.has_overflow()) {
|
||||
|
@ -1675,7 +1674,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::slice)
|
|||
++target_byte_index;
|
||||
}
|
||||
}
|
||||
// h. Else,
|
||||
// i. Else,
|
||||
else {
|
||||
// i. Let n be 0.
|
||||
u32 n = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue