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-%typedarray%.from
8 If the mapper function makes result typed array out-of-bounds, .from performs Set operation which ignores out-of-bounds indices.
10 %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] )
13 12. Repeat, while k < len,
15 c. If mapping is true, then
16 i. Let mappedValue be ? Call(mapfn, thisArg, « kValue, 𝔽(k) »).
18 e. Perform ? Set(targetObj, Pk, mappedValue, true).
20 features: [TypedArray, resizable-arraybuffer]
23 let rab = new ArrayBuffer(3, {maxByteLength: 5});
24 let target = new Int8Array(rab);
25 target.set([0, 1, 2]);
27 let result = Int32Array.from.call(function() {
36 assert.sameValue(result, target);
37 assert.sameValue(result.length, 1);
38 assert.sameValue(result[0], 10);