tor-browser

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

non-shared-bufferdata-index-evaluation-throws.js (909B)


      1 // |reftest| skip-if(!this.hasOwnProperty('Atomics')) -- Atomics is not enabled unconditionally
      2 // Copyright (C) 2020 Rick Waldron. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 /*---
      5 esid: sec-atomics.notify
      6 description: >
      7  Evaluates index before returning 0, when TA.buffer is not a SharedArrayBuffer
      8 info: |
      9  Atomics.notify( typedArray, index, count )
     10 
     11  Let buffer be ? ValidateIntegerTypedArray(typedArray, true).
     12  Let i be ? ValidateAtomicAccess(typedArray, index).
     13  ...
     14  If IsSharedArrayBuffer(buffer) is false, return 0.
     15 
     16 features: [ArrayBuffer, Atomics, BigInt, TypedArray]
     17 ---*/
     18 
     19 const i64a = new BigInt64Array(
     20  new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 8)
     21 );
     22 
     23 const poisoned = {
     24  valueOf() {
     25    throw new Test262Error();
     26  }
     27 };
     28 
     29 assert.throws(Test262Error, function() {
     30  Atomics.notify(i64a, 0, poisoned);
     31 });
     32 
     33 
     34 
     35 reportCompare(0, 0);