tor-browser

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

false-for-timeout.js (1534B)


      1 // |reftest| skip-if(!xulRuntime.shell||!this.hasOwnProperty('Atomics')||!this.hasOwnProperty('SharedArrayBuffer')||(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('arm64-simulator'))) -- browser cannot block main thread, Atomics,SharedArrayBuffer is not enabled unconditionally, ARM64 Simulator cannot emulate atomics
      2 // Copyright (C) 2018 Amal Hussein. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 
      5 /*---
      6 esid: sec-atomics.wait
      7 description: >
      8  False timeout arg should result in an +0 timeout
      9 info: |
     10  Atomics.wait( typedArray, index, value, timeout )
     11 
     12  4. Let q be ? ToNumber(timeout).
     13 
     14    Boolean -> If argument is true, return 1. If argument is false, return +0.
     15 
     16 features: [Atomics, BigInt, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray]
     17 flags: [CanBlockIsTrue]
     18 ---*/
     19 
     20 const i64a = new BigInt64Array(
     21  new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
     22 );
     23 
     24 const valueOf = {
     25  valueOf: function() {
     26    return false;
     27  }
     28 };
     29 
     30 const toPrimitive = {
     31  [Symbol.toPrimitive]: function() {
     32    return false;
     33  }
     34 };
     35 
     36 assert.sameValue(
     37  Atomics.wait(i64a, 0, 0n, false),
     38  "timed-out",
     39  'Atomics.wait(i64a, 0, 0n, false) returns "timed-out"'
     40 );
     41 assert.sameValue(
     42  Atomics.wait(i64a, 0, 0n, valueOf),
     43  "timed-out",
     44  'Atomics.wait(i64a, 0, 0n, valueOf) returns "timed-out"'
     45 );
     46 assert.sameValue(
     47  Atomics.wait(i64a, 0, 0n, toPrimitive),
     48  "timed-out",
     49  'Atomics.wait(i64a, 0, 0n, toPrimitive) returns "timed-out"'
     50 );
     51 
     52 reportCompare(0, 0);