Debian Codegraph @

js/src/tests/test262/built-ins/ArrayBuffer/options-maxbytelength-undefined.js

raw
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 undefined
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 2. Let maxByteLength be ? Get(options, "maxByteLength").
19 3. If maxByteLength is undefined, return empty.
20 features: [resizable-arraybuffer]
21 ---*/
22
23 assert.sameValue(new ArrayBuffer(0, {}).resizable, false);
24 assert.sameValue(new ArrayBuffer(0, {maxByteLength: undefined}).resizable, false);
25
26 reportCompare(0, 0);