nonshared-int-views.js (762B)
1 // |reftest| skip-if(!this.hasOwnProperty('Atomics')) -- Atomics is not enabled unconditionally 2 // Copyright (C) 2017 Mozilla Corporation. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-atomics.exchange 7 description: > 8 Atomics.exchange throws when operating on non-sharable integer TypedArrays 9 includes: [testTypedArray.js] 10 features: [ArrayBuffer, Atomics, TypedArray] 11 ---*/ 12 13 testWithNonAtomicsFriendlyTypedArrayConstructors(TA => { 14 const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4); 15 const view = new TA(buffer); 16 17 assert.throws(TypeError, function() { 18 Atomics.exchange(view, 0, 0); 19 }, `Atomics.exchange(new ${TA.name}(buffer), 0, 0) throws TypeError`); 20 }); 21 22 reportCompare(0, 0);