tor-browser

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

non-shared-int-views-throws.js (741B)


      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 /*---
      6 esid: sec-atomics.store
      7 description: >
      8  Atomics.store throws when operating on non-sharable integer TypedArrays
      9 includes: [testTypedArray.js]
     10 features: [ArrayBuffer, Atomics, TypedArray]
     11 ---*/
     12 testWithNonAtomicsFriendlyTypedArrayConstructors(TA => {
     13  const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4);
     14  const view = new TA(buffer);
     15 
     16  assert.throws(TypeError, function() {
     17    Atomics.store(view, 0, 1);
     18  }, `Atomics.store(new ${TA.name}(buffer), 0, 1) throws TypeError`);
     19 });
     20 
     21 reportCompare(0, 0);