options-non-object.js (1251B)
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 a non-object value for options 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 4. If requestedMaxByteLength is empty, then 13 a. Return ? AllocateArrayBuffer(NewTarget, byteLength). 14 15 1.1.5 GetArrayBufferMaxByteLengthOption ( options ) 16 17 1. If Type(options) is not Object, return empty. 18 features: [resizable-arraybuffer] 19 ---*/ 20 21 assert.sameValue(new ArrayBuffer(0, null).resizable, false, 'null'); 22 assert.sameValue(new ArrayBuffer(0, true).resizable, false, 'boolean'); 23 assert.sameValue(new ArrayBuffer(0, Symbol(3)).resizable, false, 'symbol'); 24 assert.sameValue(new ArrayBuffer(0, 1n).resizable, false, 'bigint'); 25 assert.sameValue(new ArrayBuffer(0, 'string').resizable, false, 'string'); 26 assert.sameValue(new ArrayBuffer(0, 9).resizable, false, 'number'); 27 assert.sameValue(new ArrayBuffer(0, undefined).resizable, false, 'undefined'); 28 29 reportCompare(0, 0);