2018-03-20 00:50:28 +01: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: >
|
|
|
|
Atomics.wait throws if agent cannot be suspended, CanBlock is false
|
|
|
|
info: |
|
|
|
|
Assuming [[CanBlock]] is false for the main host.
|
|
|
|
|
|
|
|
Atomics.wait( typedArray, index, value, timeout )
|
|
|
|
|
|
|
|
... (after args validation)
|
|
|
|
6. Let B be AgentCanSuspend().
|
|
|
|
7. If B is false, throw a TypeError exception.
|
|
|
|
...
|
2018-04-19 16:11:50 +02:00
|
|
|
features: [Atomics, SharedArrayBuffer, TypedArray]
|
|
|
|
flags: [CanBlockIsFalse]
|
2018-03-20 00:50:28 +01:00
|
|
|
---*/
|
|
|
|
|
2018-05-21 20:23:15 +02:00
|
|
|
const i32a = new Int32Array(
|
2018-06-25 21:17:45 +02:00
|
|
|
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
|
2018-05-21 20:23:15 +02:00
|
|
|
);
|
2018-04-19 16:11:50 +02:00
|
|
|
|
2018-03-20 00:50:28 +01:00
|
|
|
assert.throws(TypeError, function() {
|
2018-04-25 23:29:53 +02:00
|
|
|
Atomics.wait(i32a, 0, 0, 0);
|
2018-06-27 18:58:02 +02:00
|
|
|
}, '`Atomics.wait(i32a, 0, 0, 0)` throws TypeError');
|