Debian Codegraph @

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