1 // |reftest| skip-if(!this.hasOwnProperty('Atomics')||!this.hasOwnProperty('SharedArrayBuffer')||(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('arm64-simulator'))) -- 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.
8 Throws a TypeError if index arg can not be converted to an Integer
10 Atomics.wait( typedArray, index, value, timeout )
12 4. Let q be ? ToNumber(timeout).
14 Symbol --> Throw a TypeError exception.
16 features: [Atomics, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray]
19 var buffer = new SharedArrayBuffer(1024);
20 var i32a = new Int32Array(buffer);
22 var poisonedValueOf = {
24 throw new Test262Error('should not evaluate this code');
28 var poisonedToPrimitive = {
29 [Symbol.toPrimitive]: function() {
30 throw new Test262Error('passing a poisoned object using @@ToPrimitive');
34 assert.throws(Test262Error, function() {
35 Atomics.wait(i32a, 0, 0, poisonedValueOf);
36 }, '`Atomics.wait(i32a, 0, 0, poisonedValueOf)` throws Test262Error');
38 assert.throws(Test262Error, function() {
39 Atomics.wait(i32a, 0, 0, poisonedToPrimitive);
40 }, '`Atomics.wait(i32a, 0, 0, poisonedToPrimitive)` throws Test262Error');
42 assert.throws(TypeError, function() {
43 Atomics.wait(i32a, 0, 0, Symbol("foo"));
44 }, '`Atomics.wait(i32a, 0, 0, Symbol("foo"))` throws TypeError');
46 assert.throws(TypeError, function() {
47 Atomics.wait(i32a, 0, 0, Symbol("foo"));
48 }, '`Atomics.wait(i32a, 0, 0, Symbol("foo"))` throws TypeError');