not-an-object-throws.js (1360B)
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.notify 6 description: > 7 Throws a TypeError if typedArray arg is not an Object 8 info: | 9 Atomics.notify( typedArray, index, count ) 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 const poisoned = { 18 valueOf: function() { 19 throw new Test262Error('should not evaluate this code'); 20 } 21 }; 22 23 assert.throws(TypeError, function() { 24 Atomics.notify(null, poisoned, poisoned); 25 }); 26 27 assert.throws(TypeError, function() { 28 Atomics.notify(undefined, poisoned, poisoned); 29 }); 30 31 assert.throws(TypeError, function() { 32 Atomics.notify(true, poisoned, poisoned); 33 }); 34 35 assert.throws(TypeError, function() { 36 Atomics.notify(false, poisoned, poisoned); 37 }); 38 39 assert.throws(TypeError, function() { 40 Atomics.notify('***string***', poisoned, poisoned); 41 }); 42 43 assert.throws(TypeError, function() { 44 Atomics.notify(Number.NEGATIVE_INFINITY, poisoned, poisoned); 45 }); 46 47 assert.throws(TypeError, function() { 48 Atomics.notify(Symbol('***symbol***'), poisoned, poisoned); 49 }); 50 51 reportCompare(0, 0);