Debian Codegraph @

js/src/tests/test262/built-ins/Atomics/notify/non-shared-bufferdata-non-shared-int-views-throws.js

raw
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.notify
7 description: >
8 Atomics.notify throws on non-shared integer TypedArrays
9 features: [ArrayBuffer, Atomics, TypedArray]
10 ---*/
11
12 const nonsab = new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4);
13
14 const poisoned = {
15 valueOf: function() {
16 throw new Test262Error('should not evaluate this code');
17 }
18 };
19
20 assert.throws(TypeError, function() {
21 Atomics.notify(new Int16Array(nonsab), poisoned, poisoned);
22 });
23
24 assert.throws(TypeError, function() {
25 Atomics.notify(new Int8Array(nonsab), poisoned, poisoned);
26 });
27
28 assert.throws(TypeError, function() {
29 Atomics.notify(new Uint32Array(nonsab), poisoned, poisoned);
30 });
31
32 assert.throws(TypeError, function() {
33 Atomics.notify(new Uint16Array(nonsab), poisoned, poisoned);
34 });
35
36 assert.throws(TypeError, function() {
37 Atomics.notify(new Uint8Array(nonsab), poisoned, poisoned);
38 });
39
40 assert.throws(TypeError, function() {
41 Atomics.notify(new Uint8ClampedArray(nonsab), poisoned, poisoned);
42 });
43
44 reportCompare(0, 0);