tor-browser

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

true-for-timeout.js (1528B)


      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  Throws a TypeError if index arg can not be converted to an Integer
      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, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray]
     17 flags: [CanBlockIsTrue]
     18 ---*/
     19 
     20 const i32a = new Int32Array(
     21  new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
     22 );
     23 
     24 const valueOf = {
     25  valueOf: function() {
     26    return true;
     27  }
     28 };
     29 
     30 const toPrimitive = {
     31  [Symbol.toPrimitive]: function() {
     32    return true;
     33  }
     34 };
     35 
     36 assert.sameValue(
     37  Atomics.wait(i32a, 0, 0, true),
     38  'timed-out',
     39  'Atomics.wait(i32a, 0, 0, true) returns "timed-out"'
     40 );
     41 assert.sameValue(
     42  Atomics.wait(i32a, 0, 0, valueOf),
     43  'timed-out',
     44  'Atomics.wait(i32a, 0, 0, valueOf) returns "timed-out"'
     45 );
     46 assert.sameValue(
     47  Atomics.wait(i32a, 0, 0, toPrimitive),
     48  'timed-out',
     49  'Atomics.wait(i32a, 0, 0, toPrimitive) returns "timed-out"'
     50 );
     51 
     52 reportCompare(0, 0);