Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Atomics/wait/negative-timeout.js

raw
1 // Copyright (C) 2017 Mozilla Corporation. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-atomics.wait
6 description: >
7 Test that Atomics.wait times out with a negative timeout
8 ---*/
9
10 $262.agent.start(
11 `
12 $262.agent.receiveBroadcast(function (sab, id) {
13 var ia = new Int32Array(sab);
14 $262.agent.report(Atomics.wait(ia, 0, 0, -5)); // -5 => 0
15 $262.agent.leaving();
16 })
17 `);
18
19 var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
20
21 $262.agent.broadcast(ia.buffer);
22 assert.sameValue(getReport(), "timed-out");
23
24 function getReport() {
25 var r;
26 while ((r = $262.agent.getReport()) == null)
27 $262.agent.sleep(100);
28 return r;
29 }