diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /js/src/tests/test262/built-ins/TypedArrayConstructors/ctors/object-arg/iterated-array-changed-by-tonumber.js | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/TypedArrayConstructors/ctors/object-arg/iterated-array-changed-by-tonumber.js')
-rw-r--r-- | js/src/tests/test262/built-ins/TypedArrayConstructors/ctors/object-arg/iterated-array-changed-by-tonumber.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors/object-arg/iterated-array-changed-by-tonumber.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors/object-arg/iterated-array-changed-by-tonumber.js new file mode 100644 index 0000000000..6251655196 --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors/object-arg/iterated-array-changed-by-tonumber.js @@ -0,0 +1,46 @@ +// |reftest| shell-option(--enable-float16array) +// Copyright (C) 2024 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-typedarray +description: > + Modifications to input array after iteration are handled correctly. +info: | + TypedArray ( ...args ) + + ... + 6. Else, + ... + b. If firstArgument is an Object, then + ... + iv. Else, + ... + 2. Let usingIterator be ? GetMethod(firstArgument, @@iterator). + 3. If usingIterator is not undefined, then + a. Let values be ? IteratorToList(? GetIteratorFromMethod(firstArgument, usingIterator)). + b. Perform ? InitializeTypedArrayFromList(O, values). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TypedArray) { + let values = [0, { + valueOf() { + // Removes all array elements. Caller must have saved all elements. + values.length = 0; + return 100; + } + }, 2]; + + // Constructor called with array which uses the built-in array iterator. + var ta = new TypedArray(values); + + assert.sameValue(ta.length, 3); + assert.sameValue(ta[0], 0); + assert.sameValue(ta[1], 100); + assert.sameValue(ta[2], 2); +}); + +reportCompare(0, 0); |