options-maxbytelength-poisoned.js (882B)
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 throws 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 features: [resizable-arraybuffer] 19 ---*/ 20 21 var options = { 22 get maxByteLength() { 23 throw new Test262Error(); 24 } 25 }; 26 27 assert.throws(Test262Error, function() { 28 new ArrayBuffer(0, options); 29 }); 30 31 reportCompare(0, 0);