Debian Codegraph @

js/src/tests/test262/built-ins/SharedArrayBuffer/length-is-absent.js

raw
1 // |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
2 // Copyright (C) 2016 The V8 Project authors. All rights reserved.
3 // Copyright (C) 2017 Mozilla Corporation. All rights reserved.
4 // This code is governed by the BSD license found in the LICENSE file.
5
6 /*---
7 esid: sec-sharedarraybuffer-length
8 description: >
9 Returns an empty instance if length is absent
10 info: |
11 SharedArrayBuffer( length )
12
13 1. If NewTarget is undefined, throw a TypeError exception.
14 2. Let byteLength be ? ToIndex(length).
15 3. Return ? AllocateSharedArrayBuffer(NewTarget, byteLength).
16 features: [SharedArrayBuffer]
17 ---*/
18
19 var buffer = new SharedArrayBuffer();
20
21 assert.sameValue(buffer.byteLength, 0);
22
23 reportCompare(0, 0);