From caffe7e3934475824316bd130d9ae759f1e83b6b Mon Sep 17 00:00:00 2001 From: Kevin Gibbons Date: Thu, 17 Sep 2026 11:42:12 -0700 Subject: [PATCH 1/3] add tests for TA.prototype.with/filter shrinking/detaching buffer during coercion --- .../callbackfn-detachbuffer-kept-undefined.js | 33 +++++++++++++++ .../filter/BigInt/callbackfn-detachbuffer.js | 9 ++-- .../callbackfn-shrink-kept-undefined.js | 41 +++++++++++++++++++ .../filter/callbackfn-detachbuffer.js | 9 +++- .../with/BigInt/index-coercion-shrinks.js | 36 ++++++++++++++++ .../negative-index-resize-to-out-of-bounds.js | 30 ++++++++++++++ .../with/BigInt/value-coercion-shrinks.js | 36 ++++++++++++++++ .../prototype/with/index-coercion-shrinks.js | 36 ++++++++++++++++ .../prototype/with/value-coercion-shrinks.js | 36 ++++++++++++++++ 9 files changed, 261 insertions(+), 5 deletions(-) create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer-kept-undefined.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-shrink-kept-undefined.js create mode 100644 test/built-ins/TypedArray/prototype/with/BigInt/index-coercion-shrinks.js create mode 100644 test/built-ins/TypedArray/prototype/with/BigInt/negative-index-resize-to-out-of-bounds.js create mode 100644 test/built-ins/TypedArray/prototype/with/BigInt/value-coercion-shrinks.js create mode 100644 test/built-ins/TypedArray/prototype/with/index-coercion-shrinks.js create mode 100644 test/built-ins/TypedArray/prototype/with/value-coercion-shrinks.js diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer-kept-undefined.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer-kept-undefined.js new file mode 100644 index 00000000000..172649050b6 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer-kept-undefined.js @@ -0,0 +1,33 @@ +// Copyright (C) 2026 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + Keeping undefined after the callback detaches the buffer throws a TypeError, + after all callbacks have run. +includes: [detachArrayBuffer.js, testTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { + var sample = new TA(makeCtorArg([1n, 2n, 3n])); + var calls = 0; + + assert.throws(TypeError, function() { + sample.filter(function(value, index, array) { + assert.sameValue(index, calls); + assert.sameValue(array, sample); + if (calls === 0) { + assert.sameValue(value, 1n); + $DETACHBUFFER(sample.buffer); + } else { + assert.sameValue(value, undefined, "Missing elements are passed to the callback"); + } + calls++; + return true; + }); + }); + + assert.sameValue(calls, 3, "All callbacks run before converting the kept values"); +}, null, null, ["immutable"]); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js index c66add78f54..dcda1e894ef 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js @@ -14,7 +14,7 @@ info: | b. Let kValue be ? Get(O, Pk). c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). ... -includes: [detachArrayBuffer.js, testTypedArray.js] +includes: [detachArrayBuffer.js, testTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ @@ -22,16 +22,19 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { var loops = 0; var sample = new TA(makeCtorArg(2)); - sample.filter(function() { + var result = sample.filter(function(value) { var flag = true; if (loops === 0) { + assert.sameValue(value, 0n); $DETACHBUFFER(sample.buffer); } else { - flag = false; + assert.sameValue(value, undefined, "Missing elements are passed to the callback"); + flag = false; // returning 0 would throw, which is tested elsehwere } loops++; return flag; }); assert.sameValue(loops, 2); + assert.compareArray(result, [0n]); }, null, null, ["immutable"]); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-shrink-kept-undefined.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-shrink-kept-undefined.js new file mode 100644 index 00000000000..2d6056b3750 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-shrink-kept-undefined.js @@ -0,0 +1,41 @@ +// Copyright (C) 2026 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + Keeping undefined after the callback shrinks the buffer throws a TypeError, + after all callbacks have run. +includes: [testTypedArray.js] +features: [BigInt, TypedArray, resizable-arraybuffer] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + [false, true].forEach(function(fixedLength) { + var buffer = new ArrayBuffer(3 * TA.BYTES_PER_ELEMENT, { + maxByteLength: 3 * TA.BYTES_PER_ELEMENT + }); + var sample = fixedLength ? new TA(buffer, 0, 3) : new TA(buffer); + sample[0] = 1n; + sample[1] = 2n; + sample[2] = 3n; + var calls = 0; + + assert.throws(TypeError, function() { + sample.filter(function(value, index, array) { + assert.sameValue(index, calls); + assert.sameValue(array, sample); + if (calls === 0) { + assert.sameValue(value, 1n); + buffer.resize(TA.BYTES_PER_ELEMENT); + } else { + assert.sameValue(value, undefined, "Missing elements are passed to the callback"); + } + calls++; + return true; + }); + }); + + assert.sameValue(calls, 3, "All callbacks run before converting the kept values"); + }); +}, null, ["passthrough"]); diff --git a/test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js index 2f3e1ed1a64..db8d7a75802 100644 --- a/test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js +++ b/test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js @@ -13,7 +13,7 @@ info: | b. Let kValue be ? Get(O, Pk). c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). ... -includes: [detachArrayBuffer.js, testTypedArray.js] +includes: [detachArrayBuffer.js, testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ @@ -21,13 +21,18 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { var loops = 0; var sample = new TA(makeCtorArg(2)); - sample.filter(function() { + var result = sample.filter(function(value) { if (loops === 0) { + assert.sameValue(value, 0); $DETACHBUFFER(sample.buffer); + } else { + assert.sameValue(value, undefined, "Missing elements are passed to the callback"); } loops++; return true; }); assert.sameValue(loops, 2); + var converted = isFloatTypedArrayConstructor(TA) ? NaN : 0; + assert.compareArray(result, [0, converted]); }, null, null, ["immutable"]); diff --git a/test/built-ins/TypedArray/prototype/with/BigInt/index-coercion-shrinks.js b/test/built-ins/TypedArray/prototype/with/BigInt/index-coercion-shrinks.js new file mode 100644 index 00000000000..d1e3358ec6b --- /dev/null +++ b/test/built-ins/TypedArray/prototype/with/BigInt/index-coercion-shrinks.js @@ -0,0 +1,36 @@ +// Copyright (C) 2026 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.with +description: > + Copying undefined throws a TypeError after index coercion shrinks the buffer. +includes: [testTypedArray.js] +features: [BigInt, TypedArray, change-array-by-copy, resizable-arraybuffer] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var buffer = new ArrayBuffer(3 * TA.BYTES_PER_ELEMENT, { + maxByteLength: 3 * TA.BYTES_PER_ELEMENT + }); + var sample = new TA(buffer); + sample[0] = 1n; + sample[1] = 2n; + sample[2] = 3n; + var calls = 0; + var index = { + valueOf: function() { + calls++; + buffer.resize(TA.BYTES_PER_ELEMENT); + return 0; + } + }; + + // Index 0 remains valid, but copying the remaining elements reads undefined. + assert.throws(TypeError, function() { + sample.with(index, 9n); + }); + assert.sameValue(calls, 1, "index is coerced once"); + assert.sameValue(sample.length, 1); + assert.sameValue(sample[0], 1n); +}, null, ["passthrough"]); diff --git a/test/built-ins/TypedArray/prototype/with/BigInt/negative-index-resize-to-out-of-bounds.js b/test/built-ins/TypedArray/prototype/with/BigInt/negative-index-resize-to-out-of-bounds.js new file mode 100644 index 00000000000..a0f2e6a84eb --- /dev/null +++ b/test/built-ins/TypedArray/prototype/with/BigInt/negative-index-resize-to-out-of-bounds.js @@ -0,0 +1,30 @@ +// Copyright (C) 2026 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.with +description: > + A negative index is relative to the original length and throws a RangeError + if value coercion shrinks the buffer so that the index is out of bounds. +features: [BigInt, TypedArray, change-array-by-copy, resizable-arraybuffer] +includes: [testTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var byteLength = 2 * TA.BYTES_PER_ELEMENT; + var buffer = new ArrayBuffer(byteLength, {maxByteLength: byteLength}); + var sample = new TA(buffer); + + var value = { + valueOf: function() { + buffer.resize(TA.BYTES_PER_ELEMENT); + return 0n; + } + }; + + // -1 resolves to index 1 before shrinking. Reject that index before copying + // missing elements, which would instead throw a TypeError for BigInt arrays. + assert.throws(RangeError, function() { + sample.with(-1, value); + }); +}, null, ["passthrough"]); diff --git a/test/built-ins/TypedArray/prototype/with/BigInt/value-coercion-shrinks.js b/test/built-ins/TypedArray/prototype/with/BigInt/value-coercion-shrinks.js new file mode 100644 index 00000000000..8237699247a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/with/BigInt/value-coercion-shrinks.js @@ -0,0 +1,36 @@ +// Copyright (C) 2026 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.with +description: > + Copying undefined throws a TypeError after value coercion shrinks the buffer. +includes: [testTypedArray.js] +features: [BigInt, TypedArray, change-array-by-copy, resizable-arraybuffer] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var buffer = new ArrayBuffer(3 * TA.BYTES_PER_ELEMENT, { + maxByteLength: 3 * TA.BYTES_PER_ELEMENT + }); + var sample = new TA(buffer); + sample[0] = 1n; + sample[1] = 2n; + sample[2] = 3n; + var calls = 0; + var value = { + valueOf: function() { + calls++; + buffer.resize(TA.BYTES_PER_ELEMENT); + return 9n; + } + }; + + // Index 0 remains valid, but copying the remaining elements reads undefined. + assert.throws(TypeError, function() { + sample.with(0, value); + }); + assert.sameValue(calls, 1, "value is coerced once"); + assert.sameValue(sample.length, 1); + assert.sameValue(sample[0], 1n); +}, null, ["passthrough"]); diff --git a/test/built-ins/TypedArray/prototype/with/index-coercion-shrinks.js b/test/built-ins/TypedArray/prototype/with/index-coercion-shrinks.js new file mode 100644 index 00000000000..5c4b6f41163 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/with/index-coercion-shrinks.js @@ -0,0 +1,36 @@ +// Copyright (C) 2026 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.with +description: > + Missing elements are converted to NaN or zero after index coercion shrinks the buffer. +includes: [testTypedArray.js, compareArray.js] +features: [TypedArray, change-array-by-copy, resizable-arraybuffer] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var buffer = new ArrayBuffer(3 * TA.BYTES_PER_ELEMENT, { + maxByteLength: 3 * TA.BYTES_PER_ELEMENT + }); + var sample = new TA(buffer); + sample[0] = 1; + sample[1] = 2; + sample[2] = 3; + var calls = 0; + var index = { + valueOf: function() { + calls++; + buffer.resize(TA.BYTES_PER_ELEMENT); + return 0; + } + }; + + // Index 0 remains valid, but copying the remaining elements reads undefined. + var result = sample.with(index, 9); + var converted = isFloatTypedArrayConstructor(TA) ? NaN : 0; + assert.compareArray(result, [9, converted, converted]); + assert.sameValue(calls, 1, "index is coerced once"); + assert.sameValue(sample.length, 1); + assert.sameValue(sample[0], 1); +}, null, ["passthrough"]); diff --git a/test/built-ins/TypedArray/prototype/with/value-coercion-shrinks.js b/test/built-ins/TypedArray/prototype/with/value-coercion-shrinks.js new file mode 100644 index 00000000000..7573f81fdf3 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/with/value-coercion-shrinks.js @@ -0,0 +1,36 @@ +// Copyright (C) 2026 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.with +description: > + Missing elements are converted to NaN or zero after value coercion shrinks the buffer. +includes: [testTypedArray.js, compareArray.js] +features: [TypedArray, change-array-by-copy, resizable-arraybuffer] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var buffer = new ArrayBuffer(3 * TA.BYTES_PER_ELEMENT, { + maxByteLength: 3 * TA.BYTES_PER_ELEMENT + }); + var sample = new TA(buffer); + sample[0] = 1; + sample[1] = 2; + sample[2] = 3; + var calls = 0; + var value = { + valueOf: function() { + calls++; + buffer.resize(TA.BYTES_PER_ELEMENT); + return 9; + } + }; + + // Index 0 remains valid, but copying the remaining elements reads undefined. + var result = sample.with(0, value); + var converted = isFloatTypedArrayConstructor(TA) ? NaN : 0; + assert.compareArray(result, [9, converted, converted]); + assert.sameValue(calls, 1, "value is coerced once"); + assert.sameValue(sample.length, 1); + assert.sameValue(sample[0], 1); +}, null, ["passthrough"]); From 15efced822470503d454ddaae9a3cc8298bc733d Mon Sep 17 00:00:00 2001 From: Kevin Gibbons Date: Thu, 17 Sep 2026 12:53:40 -0700 Subject: [PATCH 2/3] Apply batched suggestions from code review Co-authored-by: Richard Gibson --- .../filter/BigInt/callbackfn-detachbuffer-kept-undefined.js | 3 ++- .../prototype/filter/BigInt/callbackfn-detachbuffer.js | 3 ++- .../filter/BigInt/callbackfn-shrink-kept-undefined.js | 3 ++- .../TypedArray/prototype/filter/callbackfn-detachbuffer.js | 3 ++- .../TypedArray/prototype/with/BigInt/index-coercion-shrinks.js | 3 +-- .../TypedArray/prototype/with/BigInt/value-coercion-shrinks.js | 3 +-- .../TypedArray/prototype/with/index-coercion-shrinks.js | 3 +-- .../TypedArray/prototype/with/value-coercion-shrinks.js | 3 +-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer-kept-undefined.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer-kept-undefined.js index 172649050b6..6d264624ba9 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer-kept-undefined.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer-kept-undefined.js @@ -22,7 +22,8 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(value, 1n); $DETACHBUFFER(sample.buffer); } else { - assert.sameValue(value, undefined, "Missing elements are passed to the callback"); + assert.sameValue(value, undefined, + "callback element is undefined for index " + index); } calls++; return true; diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js index dcda1e894ef..c1b88f6a6fe 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js @@ -28,7 +28,8 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(value, 0n); $DETACHBUFFER(sample.buffer); } else { - assert.sameValue(value, undefined, "Missing elements are passed to the callback"); + assert.sameValue(value, undefined, + "callback element is undefined for index " + index); flag = false; // returning 0 would throw, which is tested elsehwere } loops++; diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-shrink-kept-undefined.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-shrink-kept-undefined.js index 2d6056b3750..cd7fce6fac1 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-shrink-kept-undefined.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-shrink-kept-undefined.js @@ -29,7 +29,8 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(value, 1n); buffer.resize(TA.BYTES_PER_ELEMENT); } else { - assert.sameValue(value, undefined, "Missing elements are passed to the callback"); + assert.sameValue(value, undefined, + "callback element is undefined for index " + index); } calls++; return true; diff --git a/test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js index db8d7a75802..34676c2030c 100644 --- a/test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js +++ b/test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js @@ -26,7 +26,8 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(value, 0); $DETACHBUFFER(sample.buffer); } else { - assert.sameValue(value, undefined, "Missing elements are passed to the callback"); + assert.sameValue(value, undefined, + "callback element is undefined for index " + index); } loops++; return true; diff --git a/test/built-ins/TypedArray/prototype/with/BigInt/index-coercion-shrinks.js b/test/built-ins/TypedArray/prototype/with/BigInt/index-coercion-shrinks.js index d1e3358ec6b..7be11a3da4f 100644 --- a/test/built-ins/TypedArray/prototype/with/BigInt/index-coercion-shrinks.js +++ b/test/built-ins/TypedArray/prototype/with/BigInt/index-coercion-shrinks.js @@ -31,6 +31,5 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample.with(index, 9n); }); assert.sameValue(calls, 1, "index is coerced once"); - assert.sameValue(sample.length, 1); - assert.sameValue(sample[0], 1n); + assert.compareArray(sample, [1n]); }, null, ["passthrough"]); diff --git a/test/built-ins/TypedArray/prototype/with/BigInt/value-coercion-shrinks.js b/test/built-ins/TypedArray/prototype/with/BigInt/value-coercion-shrinks.js index 8237699247a..d5a35464b03 100644 --- a/test/built-ins/TypedArray/prototype/with/BigInt/value-coercion-shrinks.js +++ b/test/built-ins/TypedArray/prototype/with/BigInt/value-coercion-shrinks.js @@ -31,6 +31,5 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample.with(0, value); }); assert.sameValue(calls, 1, "value is coerced once"); - assert.sameValue(sample.length, 1); - assert.sameValue(sample[0], 1n); + assert.compareArray(sample, [1n]); }, null, ["passthrough"]); diff --git a/test/built-ins/TypedArray/prototype/with/index-coercion-shrinks.js b/test/built-ins/TypedArray/prototype/with/index-coercion-shrinks.js index 5c4b6f41163..ec15babadac 100644 --- a/test/built-ins/TypedArray/prototype/with/index-coercion-shrinks.js +++ b/test/built-ins/TypedArray/prototype/with/index-coercion-shrinks.js @@ -31,6 +31,5 @@ testWithTypedArrayConstructors(function(TA) { var converted = isFloatTypedArrayConstructor(TA) ? NaN : 0; assert.compareArray(result, [9, converted, converted]); assert.sameValue(calls, 1, "index is coerced once"); - assert.sameValue(sample.length, 1); - assert.sameValue(sample[0], 1); + assert.compareArray(sample, [1]); }, null, ["passthrough"]); diff --git a/test/built-ins/TypedArray/prototype/with/value-coercion-shrinks.js b/test/built-ins/TypedArray/prototype/with/value-coercion-shrinks.js index 7573f81fdf3..8267776de24 100644 --- a/test/built-ins/TypedArray/prototype/with/value-coercion-shrinks.js +++ b/test/built-ins/TypedArray/prototype/with/value-coercion-shrinks.js @@ -31,6 +31,5 @@ testWithTypedArrayConstructors(function(TA) { var converted = isFloatTypedArrayConstructor(TA) ? NaN : 0; assert.compareArray(result, [9, converted, converted]); assert.sameValue(calls, 1, "value is coerced once"); - assert.sameValue(sample.length, 1); - assert.sameValue(sample[0], 1); + assert.compareArray(sample, [1]); }, null, ["passthrough"]); From 992531687e5b40bf7d7503b584d93fc1a839ca43 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Fri, 18 Sep 2026 12:17:08 -0400 Subject: [PATCH 3/3] Apply batched suggestions from code review Co-authored-by: Richard Gibson --- .../prototype/filter/BigInt/callbackfn-detachbuffer.js | 2 +- .../TypedArray/prototype/filter/callbackfn-detachbuffer.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js index c1b88f6a6fe..7d34df6e0cf 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js @@ -22,7 +22,7 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { var loops = 0; var sample = new TA(makeCtorArg(2)); - var result = sample.filter(function(value) { + var result = sample.filter(function(value, index) { var flag = true; if (loops === 0) { assert.sameValue(value, 0n); diff --git a/test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js index 34676c2030c..05a6b2fa1d5 100644 --- a/test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js +++ b/test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js @@ -21,7 +21,7 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { var loops = 0; var sample = new TA(makeCtorArg(2)); - var result = sample.filter(function(value) { + var result = sample.filter(function(value, index) { if (loops === 0) { assert.sameValue(value, 0); $DETACHBUFFER(sample.buffer);