tor-browser

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

options-maxbytelength-poisoned.js (1035B)


      1 // |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
      2 // Copyright (C) 2021 the V8 project authors. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 /*---
      5 esid: sec-sharedarraybuffer-constructor
      6 description: Invoked with an options object whose `maxByteLength` property throws
      7 info: |
      8  SharedArrayBuffer( length [ , options ] )
      9 
     10  1. If NewTarget is undefined, throw a TypeError exception.
     11  2. Let byteLength be ? ToIndex(length).
     12  3. Let requestedMaxByteLength be ? GetArrayBufferMaxByteLengthOption(options).
     13  [...]
     14 
     15  1.1.5 GetArrayBufferMaxByteLengthOption ( options )
     16 
     17  1. If Type(options) is not Object, return empty.
     18  2. Let maxByteLength be ? Get(options, "maxByteLength").
     19 features: [SharedArrayBuffer, resizable-arraybuffer]
     20 ---*/
     21 
     22 var options = {
     23  get maxByteLength() {
     24    throw new Test262Error();
     25  }
     26 };
     27 
     28 assert.throws(Test262Error, function() {
     29  new SharedArrayBuffer(0, options);
     30 });
     31 
     32 reportCompare(0, 0);