non-shared-bufferdata-count-evaluation-throws.js (927B)
1 // |reftest| skip-if(!this.hasOwnProperty('Atomics')) -- Atomics is not enabled unconditionally 2 // Copyright (C) 2020 Rick Waldron. 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 Evaluates count before returning 0, when TA.buffer is not a SharedArrayBuffer 8 info: | 9 Atomics.notify( typedArray, index, count ) 10 11 Let buffer be ? ValidateIntegerTypedArray(typedArray, true). 12 ... 13 Else, 14 Let intCount be ? ToInteger(count). 15 Let c be max(intCount, 0). 16 ... 17 If IsSharedArrayBuffer(buffer) is false, return 0. 18 19 20 features: [ArrayBuffer, Atomics, TypedArray] 21 ---*/ 22 23 const i32a = new Int32Array( 24 new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) 25 ); 26 27 const poisoned = { 28 valueOf() { 29 throw new Test262Error(); 30 } 31 }; 32 33 assert.throws(Test262Error, function() { 34 Atomics.notify(i32a, 0, poisoned); 35 }); 36 37 38 39 reportCompare(0, 0);