tor-browser

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

symbol-for-timeout-throws.js (1481B)


      1 // |reftest| skip-if(!this.hasOwnProperty('Atomics')||!this.hasOwnProperty('SharedArrayBuffer')||(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('arm64-simulator'))) -- 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    Symbol --> Throw a TypeError exception.
     15 
     16 features: [Atomics, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray]
     17 ---*/
     18 
     19 var buffer = new SharedArrayBuffer(1024);
     20 var i32a = new Int32Array(buffer);
     21 
     22 var poisonedValueOf = {
     23  valueOf: function() {
     24    throw new Test262Error('should not evaluate this code');
     25  }
     26 };
     27 
     28 var poisonedToPrimitive = {
     29  [Symbol.toPrimitive]: function() {
     30    throw new Test262Error('passing a poisoned object using @@ToPrimitive');
     31  }
     32 };
     33 
     34 assert.throws(Test262Error, function() {
     35  Atomics.wait(i32a, 0, 0, poisonedValueOf);
     36 });
     37 
     38 assert.throws(Test262Error, function() {
     39  Atomics.wait(i32a, 0, 0, poisonedToPrimitive);
     40 });
     41 
     42 assert.throws(TypeError, function() {
     43  Atomics.wait(i32a, 0, 0, Symbol("foo"));
     44 });
     45 
     46 assert.throws(TypeError, function() {
     47  Atomics.wait(i32a, 0, 0, Symbol("foo"));
     48 });
     49 
     50 reportCompare(0, 0);