1 // |reftest| shell-option(--enable-arraybuffer-resizable) skip-if(!ArrayBuffer.prototype.resize||!xulRuntime.shell) -- resizable-arraybuffer is not enabled unconditionally, requires shell-options
2 // Copyright (C) 2024 André Bargull. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
6 esid: sec-typedarraysetelement
8 Index is validated after converting the right-hand side operand.
10 TypedArraySetElement ( O, index, value )
12 2. Otherwise, let numValue be ? ToNumber(value).
13 3. If IsValidIntegerIndex(O, index) is true, then
16 features: [TypedArray, resizable-arraybuffer]
19 let rab = new ArrayBuffer(0, {maxByteLength: 1});
20 let ta = new Int8Array(rab);
22 // Index is initially out-of-bounds.
27 // Make `index` an in-bounds access.
33 assert.sameValue(ta.length, 0);
37 assert.sameValue(ta.length, 1);
38 assert.sameValue(ta[0], 100);