tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

negative-timeout.js (1394B)


      1 // |reftest| shell-option(--setpref=atomics_wait_async) skip-if(!this.hasOwnProperty('SharedArrayBuffer')||!this.hasOwnProperty('Atomics')||(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('arm64-simulator'))||!xulRuntime.shell) async -- SharedArrayBuffer,Atomics is not enabled unconditionally, ARM64 Simulator cannot emulate atomics, requires shell-options
      2 // Copyright (C) 2020 Rick Waldron. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 
      5 /*---
      6 esid: sec-atomics.waitasync
      7 description: >
      8  Test that Atomics.waitAsync times out with a negative timeout
      9 info: |
     10  Atomics.waitAsync( typedArray, index, value, timeout )
     11 
     12  1. Return DoWait(async, typedArray, index, value, timeout).
     13 
     14  DoWait ( mode, typedArray, index, value, timeout )
     15 
     16  6. Let q be ? ToNumber(timeout).
     17 
     18 flags: [async]
     19 features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, destructuring-binding, arrow-function]
     20 ---*/
     21 assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
     22 const i32a = new Int32Array(
     23  new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
     24 );
     25 
     26 Promise.all([
     27    Atomics.waitAsync(i32a, 0, 0, -1).value,
     28  ]).then(([outcome]) => {
     29    assert.sameValue(
     30      outcome,
     31      'timed-out',
     32      'The value of `outcome` is "timed-out"'
     33    );
     34  }).then($DONE, $DONE);