2018-03-16 20:41:59 +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: >
|
|
|
|
Throws a TypeError if timeout arg is a Symbol
|
|
|
|
info: |
|
|
|
|
Atomics.wait( typedArray, index, value, timeout )
|
|
|
|
|
|
|
|
4.Let q be ? ToNumber(timeout).
|
2018-03-20 01:06:53 +01:00
|
|
|
...
|
|
|
|
Symbol Throw a TypeError exception.
|
|
|
|
features: [Atomics, SharedArrayBuffer, TypedArray, Symbol]
|
2018-03-16 20:41:59 +01:00
|
|
|
---*/
|
|
|
|
|
|
|
|
function getReport() {
|
|
|
|
var r;
|
|
|
|
while ((r = $262.agent.getReport()) == null) {
|
|
|
|
$262.agent.sleep(100);
|
|
|
|
}
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
$262.agent.start(
|
|
|
|
`
|
2018-03-20 01:06:53 +01:00
|
|
|
$262.agent.receiveBroadcast(function (sab) {
|
|
|
|
|
|
|
|
var int32Array = new Int32Array(sab);
|
2018-03-19 19:14:43 +01:00
|
|
|
var err;
|
2018-03-16 20:41:59 +01:00
|
|
|
|
|
|
|
try {
|
2018-03-20 01:06:53 +01:00
|
|
|
Atomics.wait(int32Array, 0, 0, Symbol('foo'));
|
2018-03-16 20:41:59 +01:00
|
|
|
} catch(e) {
|
2018-03-19 19:14:43 +01:00
|
|
|
err = e.name;
|
2018-03-16 20:41:59 +01:00
|
|
|
}
|
2018-03-20 01:06:53 +01:00
|
|
|
|
2018-03-19 19:14:43 +01:00
|
|
|
$262.agent.report(err);
|
2018-03-16 20:41:59 +01:00
|
|
|
$262.agent.leaving();
|
|
|
|
})
|
|
|
|
`);
|
|
|
|
|
2018-03-20 01:06:53 +01:00
|
|
|
var sab = new SharedArrayBuffer(4);
|
|
|
|
var int32Array = new Int32Array(sab);
|
2018-03-16 20:41:59 +01:00
|
|
|
|
|
|
|
$262.agent.broadcast(int32Array.buffer);
|
|
|
|
|
2018-03-20 01:06:53 +01:00
|
|
|
assert.sameValue(getReport(), 'TypeError');
|