tor-browser

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

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


      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, TypedArray]
     17 ---*/
     18 
     19 const i32a = new Int32Array(
     20  new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
     21 );
     22 
     23 const poisoned = {
     24  valueOf: function() {
     25    throw new Test262Error('should not evaluate this code');
     26  }
     27 };
     28 
     29 assert.throws(TypeError, function() {
     30  Atomics.wait(i32a, 0, 0, 0);
     31 });
     32 
     33 assert.throws(TypeError, function() {
     34  Atomics.wait(i32a, poisoned, poisoned, poisoned);
     35 });
     36 
     37 reportCompare(0, 0);