options-maxbytelength-diminuitive.js (798B)
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: | 6 Invoked with an options object whose `maxByteLength` property is less than 7 the length. 8 info: | 9 ArrayBuffer( length [ , options ] ) 10 11 1. If NewTarget is undefined, throw a TypeError exception. 12 2. Let byteLength be ? ToIndex(length). 13 3. Let requestedMaxByteLength be ? GetArrayBufferMaxByteLengthOption(options). 14 4. If requestedMaxByteLength is empty, then 15 a. [...] 16 5. If byteLength > requestedMaxByteLength, throw a RangeError exception. 17 features: [resizable-arraybuffer] 18 ---*/ 19 20 assert.throws(RangeError, function() { 21 new ArrayBuffer(1, {maxByteLength: 0}); 22 }); 23 24 reportCompare(0, 0);