Debian Codegraph @

js/src/tests/test262/built-ins/Atomics/notify/non-shared-bufferdata-index-evaluation-throws.js

raw
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 index 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 Let i be ? ValidateAtomicAccess(typedArray, index).
13 ...
14 If IsSharedArrayBuffer(buffer) is false, return 0.
15
16 features: [ArrayBuffer, Atomics, TypedArray]
17 ---*/
18
19 const i32a = new Int32Array(
20 new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
21 );
22
23 const poisoned = {
24 valueOf() {
25 throw new Test262Error();
26 }
27 };
28
29 assert.throws(Test262Error, function() {
30 Atomics.notify(i32a, poisoned, 0);
31 });
32
33
34
35 reportCompare(0, 0);