Debian Codegraph @

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

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