tor-browser

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

non-shared-bufferdata-throws.js (1069B)


      1 // |reftest| skip-if(!this.hasOwnProperty('Atomics')) -- Atomics is not enabled unconditionally
      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 esid: sec-atomics.wait
      6 description: >
      7  Throws a TypeError if typedArray.buffer is not a SharedArrayBuffer
      8 info: |
      9  Atomics.wait( typedArray, index, value, timeout )
     10 
     11  1.Let buffer be ? ValidateSharedIntegerTypedArray(typedArray, true).
     12    ...
     13      9.If IsSharedArrayBuffer(buffer) is false, throw a TypeError exception.
     14        ...
     15          4.If bufferData is a Data Block, return false.
     16 features: [ArrayBuffer, Atomics, BigInt, TypedArray]
     17 ---*/
     18 const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT));
     19 
     20 const poisoned = {
     21  valueOf: function() {
     22    throw new Test262Error('should not evaluate this code');
     23  }
     24 };
     25 
     26 assert.throws(TypeError, function() {
     27  Atomics.wait(i64a, 0, 0n, 0);
     28 });
     29 
     30 assert.throws(TypeError, function() {
     31  Atomics.wait(i64a, poisoned, poisoned, poisoned);
     32 });
     33 
     34 reportCompare(0, 0);