Debian Codegraph @

js/src/tests/test262/built-ins/Atomics/wait/bigint/cannot-suspend-throws.js

raw
1 // |reftest| skip-if(xulRuntime.shell||!this.hasOwnProperty('Atomics')||!this.hasOwnProperty('SharedArrayBuffer')||(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('arm64-simulator'))) -- shell can block main thread, Atomics,SharedArrayBuffer is not enabled unconditionally, ARM64 Simulator cannot emulate atomics
2 // Copyright (C) 2018 Amal Hussein. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 esid: sec-atomics.wait
6 description: >
7 Atomics.wait throws if agent cannot be suspended, CanBlock is false
8 info: |
9 Assuming [[CanBlock]] is false for the main host.
10
11 Atomics.wait( typedArray, index, value, timeout )
12
13 ... (after args validation)
14 6. Let B be AgentCanSuspend().
15 7. If B is false, throw a TypeError exception.
16 ...
17 features: [Atomics, BigInt, SharedArrayBuffer, TypedArray]
18 flags: [CanBlockIsFalse]
19 ---*/
20
21 const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
22
23 assert.throws(TypeError, function() {
24 Atomics.wait(i64a, 0, 0n, 0);
25 });
26
27 reportCompare(0, 0);