options-maxbytelength-excessive.js (1143B)
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: | 7 Invoked with an options object whose `maxByteLength` property exceeds the 8 maximum length value 9 info: | 10 SharedArrayBuffer( length [ , options ] ) 11 12 1. If NewTarget is undefined, throw a TypeError exception. 13 2. Let byteLength be ? ToIndex(length). 14 3. Let requestedMaxByteLength be ? GetArrayBufferMaxByteLengthOption(options). 15 [...] 16 17 1.1.5 GetArrayBufferMaxByteLengthOption ( options ) 18 19 1. If Type(options) is not Object, return empty. 20 2. Let maxByteLength be ? Get(options, "maxByteLength"). 21 3. If maxByteLength is undefined, return empty. 22 4. Return ? ToIndex(maxByteLength). 23 features: [SharedArrayBuffer, resizable-arraybuffer] 24 ---*/ 25 26 assert.throws(RangeError, function() { 27 // Math.pow(2, 53) = 9007199254740992 28 new SharedArrayBuffer(0, { maxByteLength: 9007199254740992 }); 29 }); 30 31 reportCompare(0, 0);