not-an-object-throws.js (1419B)
1 // |reftest| skip-if(!this.hasOwnProperty('Atomics')) -- Atomics is not enabled unconditionally 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 Throws a TypeError if typedArray arg is not an Object 8 info: | 9 Atomics.wait( typedArray, index, value, timeout ) 10 11 1.Let buffer be ? ValidateSharedIntegerTypedArray(typedArray, true). 12 ... 13 2. if Type(typedArray) is not Object, throw a TypeError exception 14 features: [Atomics, Symbol] 15 ---*/ 16 17 var poisoned = { 18 valueOf: function() { 19 throw new Test262Error('should not evaluate this code'); 20 } 21 }; 22 23 assert.throws(TypeError, function() { 24 Atomics.wait(null, poisoned, poisoned, poisoned); 25 }); 26 27 assert.throws(TypeError, function() { 28 Atomics.wait(undefined, poisoned, poisoned, poisoned); 29 }); 30 31 assert.throws(TypeError, function() { 32 Atomics.wait(true, poisoned, poisoned, poisoned); 33 }); 34 35 assert.throws(TypeError, function() { 36 Atomics.wait(false, poisoned, poisoned, poisoned); 37 }); 38 39 assert.throws(TypeError, function() { 40 Atomics.wait('***string***', poisoned, poisoned, poisoned); 41 }); 42 43 assert.throws(TypeError, function() { 44 Atomics.wait(Number.NEGATIVE_INFINITY, poisoned, poisoned, poisoned); 45 }); 46 47 assert.throws(TypeError, function() { 48 Atomics.wait(Symbol('***symbol***'), poisoned, poisoned, poisoned); 49 }); 50 51 reportCompare(0, 0);