From 677fb82a754617457ab649a2e6b2ad823aebf20b Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Fri, 3 Apr 2020 12:02:30 -0400 Subject: [PATCH] Atomics.waitAsync: false for timeouts, revised. --- .../waitAsync/false-for-timeout-agent.js | 6 ++-- .../Atomics/waitAsync/false-for-timeout.js | 33 ++++++------------- 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/test/built-ins/Atomics/waitAsync/false-for-timeout-agent.js b/test/built-ins/Atomics/waitAsync/false-for-timeout-agent.js index b9091cfa4c..b03c60788e 100644 --- a/test/built-ins/Atomics/waitAsync/false-for-timeout-agent.js +++ b/test/built-ins/Atomics/waitAsync/false-for-timeout-agent.js @@ -36,9 +36,9 @@ $262.agent.start(` const i32a = new Int32Array(sab); Atomics.add(i32a, ${RUNNING}, 1); - const status1 = await Atomics.waitAsync(i32a, 0, 0, false); - const status2 = await Atomics.waitAsync(i32a, 0, 0, valueOf); - const status3 = await Atomics.waitAsync(i32a, 0, 0, toPrimitive); + const status1 = await Atomics.waitAsync(i32a, 0, 0, false).value; + const status2 = await Atomics.waitAsync(i32a, 0, 0, valueOf).value; + const status3 = await Atomics.waitAsync(i32a, 0, 0, toPrimitive).value; $262.agent.report(status1); $262.agent.report(status2); diff --git a/test/built-ins/Atomics/waitAsync/false-for-timeout.js b/test/built-ins/Atomics/waitAsync/false-for-timeout.js index 0a1206caf5..5dd8de86b6 100644 --- a/test/built-ins/Atomics/waitAsync/false-for-timeout.js +++ b/test/built-ins/Atomics/waitAsync/false-for-timeout.js @@ -14,7 +14,7 @@ info: | 6. Let q be ? ToNumber(timeout). -flags: [async, CanBlockIsTrue] +flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics] ---*/ @@ -34,25 +34,12 @@ const toPrimitive = { } }; -(async () => { - try { - assert.sameValue( - await Atomics.waitAsync(i32a, 0, 0, false), - 'timed-out', - 'Atomics.waitAsync(i32a, 0, 0, false) returns "timed-out"' - ); - assert.sameValue( - await Atomics.waitAsync(i32a, 0, 0, valueOf), - 'timed-out', - 'Atomics.waitAsync(i32a, 0, 0, valueOf) returns "timed-out"' - ); - assert.sameValue( - await Atomics.waitAsync(i32a, 0, 0, toPrimitive), - 'timed-out', - 'Atomics.waitAsync(i32a, 0, 0, toPrimitive) returns "timed-out"' - ); - $DONE(); - } catch (error) { - $DONE(error); - } -})(); +Promise.all([ + Atomics.waitAsync(i32a, 0, 0, false).value, + Atomics.waitAsync(i32a, 0, 0, valueOf).value, + Atomics.waitAsync(i32a, 0, 0, toPrimitive).value, + ]).then(outcomes => { + assert.sameValue(outcomes[0], "timed-out"); + assert.sameValue(outcomes[0], "timed-out"); + assert.sameValue(outcomes[0], "timed-out"); + }, $DONE).then($DONE, $DONE);