options-maxbytelength-negative.js (909B)
1 // Copyright (C) 2021 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 esid: sec-arraybuffer-constructor 5 description: Invoked with an options object whose `maxByteLength` property is negative 6 info: | 7 ArrayBuffer( length [ , options ] ) 8 9 1. If NewTarget is undefined, throw a TypeError exception. 10 2. Let byteLength be ? ToIndex(length). 11 3. Let requestedMaxByteLength be ? GetArrayBufferMaxByteLengthOption(options). 12 [...] 13 14 1.1.5 GetArrayBufferMaxByteLengthOption ( options ) 15 16 1. If Type(options) is not Object, return empty. 17 2. Let maxByteLength be ? Get(options, "maxByteLength"). 18 3. If maxByteLength is undefined, return empty. 19 4. Return ? ToIndex(maxByteLength). 20 features: [resizable-arraybuffer] 21 ---*/ 22 23 assert.throws(RangeError, function() { 24 new ArrayBuffer(0, { maxByteLength: -1 }); 25 }); 26 27 reportCompare(0, 0);