Backed out changeset 5c7de47bcacb (bug 1927094) for causing Bug 1928689. a=backout
[gecko.git] / js / src / tests / test262 / built-ins / Atomics / compareExchange / bad-range.js
blobd37df6c8906b7a16d1f9c25ff2a33bf0cb5705d8
1 // |reftest| shell-option(--enable-float16array) 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) 2017 Mozilla Corporation.  All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
5 /*---
6 esid: sec-atomics.compareexchange
7 description: >
8   Test range checking of Atomics.compareExchange on arrays that allow atomic operations
9 includes: [testAtomics.js, testTypedArray.js]
10 features: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, Symbol, TypedArray]
11 ---*/
13 const buffer = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 2);
14 const views = nonClampedIntArrayConstructors.slice();
16 testWithTypedArrayConstructors(function(TA) {
17   const view = new TA(buffer);
18   testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
19     assert.throws(RangeError, function() {
20       Atomics.compareExchange(view, IdxGen(view), 10, 0);
21     });
22   });
23 }, views);
25 reportCompare(0, 0);