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: >
|
|
|
|
Throws a TypeError if typedArray.buffer is not a SharedArrayBuffer
|
|
|
|
info: |
|
|
|
|
Atomics.wait( typedArray, index, value, timeout )
|
|
|
|
|
|
|
|
1.Let buffer be ? ValidateSharedIntegerTypedArray(typedArray, true).
|
|
|
|
...
|
|
|
|
9.If IsSharedArrayBuffer(buffer) is false, throw a TypeError exception.
|
|
|
|
...
|
|
|
|
4.If bufferData is a Data Block, return false.
|
2018-04-26 17:40:13 +02:00
|
|
|
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
2018-04-25 23:29:53 +02:00
|
|
|
---*/
|
2020-05-20 20:37:33 +02:00
|
|
|
const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT));
|
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
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
assert.throws(TypeError, function() {
|
2018-06-27 18:58:02 +02:00
|
|
|
Atomics.wait(i64a, 0, 0n, 0);
|
2024-03-23 02:28:44 +01:00
|
|
|
});
|
2018-04-25 23:29:53 +02:00
|
|
|
|
|
|
|
assert.throws(TypeError, function() {
|
|
|
|
Atomics.wait(i64a, poisoned, poisoned, poisoned);
|
2024-03-23 02:28:44 +01:00
|
|
|
});
|