Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / Atomics / notify / bigint / null-bufferdata-throws.js
blob75e2b6b3f94dd262f8e6094b07aba098adc2d879
1 // |reftest| skip-if(!this.hasOwnProperty('Atomics')) -- Atomics is not enabled unconditionally
2 // Copyright (C) 2018 Amal Hussein. 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   A null value for bufferData throws a TypeError
8 info: |
9   Atomics.notify( typedArray, index, count )
11   1.Let buffer be ? ValidateSharedIntegerTypedArray(typedArray, true).
12     ...
13       9.If IsSharedArrayBuffer(buffer) is false, throw a TypeError exception.
14         ...
15           3.If bufferData is null, return false.
16 includes: [detachArrayBuffer.js]
17 features: [ArrayBuffer, Atomics, BigInt, TypedArray]
18 ---*/
20 const i64a = new BigInt64Array(
21   new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 8)
23 const poisoned = {
24   valueOf: function() {
25     throw new Test262Error('should not evaluate this code');
26   }
29 try {
30   $DETACHBUFFER(i64a.buffer); // Detaching a non-shared ArrayBuffer sets the [[ArrayBufferData]] value to null
31 } catch (error) {
32   throw new Test262Error(`An unexpected error occurred when detaching ArrayBuffer: ${error.message}`);
35 assert.throws(TypeError, function() {
36   Atomics.notify(i64a, poisoned, poisoned);
37 });
39 reportCompare(0, 0);