Debian Codegraph @

js/src/tests/test262/built-ins/Atomics/waitAsync/bad-range.js

raw
1 // |reftest| shell-option(--setpref=atomics_wait_async) skip-if(!this.hasOwnProperty('Atomics')||!this.hasOwnProperty('SharedArrayBuffer')||(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('arm64-simulator'))||!xulRuntime.shell) -- Atomics,SharedArrayBuffer is not enabled unconditionally, ARM64 Simulator cannot emulate atomics, requires shell-options
2 // Copyright (C) 2020 Rick Waldron. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 esid: sec-atomics.waitasync
7 description: >
8 Test range checking of Atomics.waitAsync on arrays that allow atomic operations
9 info: |
10 Atomics.waitAsync( typedArray, index, value, timeout )
11
12 1. Return DoWait(async, typedArray, index, value, timeout).
13
14 DoWait ( mode, typedArray, index, value, timeout )
15
16 ...
17 2. Let i be ? ValidateAtomicAccess(typedArray, index).
18 ...
19
20 includes: [testAtomics.js]
21 features: [Atomics.waitAsync, Atomics, SharedArrayBuffer, ArrayBuffer, DataView, Symbol, TypedArray]
22 ---*/
23 assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
24 const i32a = new Int32Array(
25 new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 8)
26 );
27
28 testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
29 assert.throws(RangeError, function() {
30 Atomics.waitAsync(i32a, IdxGen(i32a), 0, 0);
31 }, '`Atomics.waitAsync(i32a, IdxGen(i32a), 0, 0)` throws a RangeError exception');
32 });
33
34
35
36 reportCompare(0, 0);