2018-04-25 23:29:53 +02:00
|
|
|
// Copyright (C) 2018 Amal Hussein. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
/*---
|
|
|
|
esid: sec-atomics.wait
|
|
|
|
description: >
|
|
|
|
A null value for bufferData throws a TypeError
|
|
|
|
info: |
|
|
|
|
Atomics.wait( typedArray, index, value, timeout )
|
|
|
|
|
|
|
|
1.Let buffer be ? ValidateSharedIntegerTypedArray(typedArray, true).
|
2018-05-21 20:23:15 +02:00
|
|
|
...
|
|
|
|
|
|
|
|
ValidateSharedIntegerTypedArray(typedArray [ , onlyInt32 ] )
|
|
|
|
|
|
|
|
...
|
|
|
|
9.If IsSharedArrayBuffer(buffer) is false, throw a TypeError exception.
|
|
|
|
|
|
|
|
|
|
|
|
IsSharedArrayBuffer( obj )
|
|
|
|
|
|
|
|
...
|
|
|
|
3.If bufferData is null, return false.
|
|
|
|
|
2018-04-25 23:29:53 +02:00
|
|
|
includes: [detachArrayBuffer.js]
|
2018-04-26 17:40:13 +02:00
|
|
|
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
2018-04-25 23:29:53 +02:00
|
|
|
---*/
|
|
|
|
|
2018-05-21 20:23:15 +02:00
|
|
|
const i64a = new BigInt64Array(
|
2018-06-30 00:52:53 +02:00
|
|
|
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 8)
|
2018-05-21 20:23:15 +02:00
|
|
|
);
|
|
|
|
const poisoned = {
|
2018-04-25 23:29:53 +02:00
|
|
|
valueOf: function() {
|
2018-05-21 20:23:15 +02:00
|
|
|
throw new Test262Error('should not evaluate this code');
|
2018-04-25 23:29:53 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-05-21 20:23:15 +02:00
|
|
|
try {
|
|
|
|
$DETACHBUFFER(i64a.buffer); // Detaching a non-shared ArrayBuffer sets the [[ArrayBufferData]] value to null
|
|
|
|
} catch (error) {
|
|
|
|
$ERROR(`An unexpected error occurred when detaching ArrayBuffer: ${error.message}`);
|
|
|
|
}
|
2018-04-25 23:29:53 +02:00
|
|
|
|
|
|
|
assert.throws(TypeError, function() {
|
|
|
|
Atomics.wait(i64a, poisoned, poisoned, poisoned);
|
2018-06-27 18:58:02 +02:00
|
|
|
}, '`Atomics.wait(i64a, poisoned, poisoned, poisoned)` throws TypeError');
|