cannot-suspend-throws.js (1078B)
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 /*--- 6 esid: sec-atomics.wait 7 description: > 8 Atomics.wait throws if agent cannot be suspended, CanBlock is false 9 info: | 10 Assuming [[CanBlock]] is false for the main host. 11 12 Atomics.wait( typedArray, index, value, timeout ) 13 14 ... (after args validation) 15 6. Let B be AgentCanSuspend(). 16 7. If B is false, throw a TypeError exception. 17 ... 18 features: [Atomics, SharedArrayBuffer, TypedArray] 19 flags: [CanBlockIsFalse] 20 ---*/ 21 22 const i32a = new Int32Array( 23 new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) 24 ); 25 26 assert.throws(TypeError, function() { 27 Atomics.wait(i32a, 0, 0, 0); 28 }); 29 30 reportCompare(0, 0);