Debian Codegraph @

js/src/tests/test262/built-ins/SharedArrayBuffer/return-abrupt-from-length.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 Return abrupt from ToIndex(length)
10 info: |
11 SharedArrayBuffer( length )
12
13 1. If NewTarget is undefined, throw a TypeError exception.
14 2. Let byteLength be ? ToIndex(length).
15 ...
16 features: [SharedArrayBuffer]
17 ---*/
18
19 var len = {
20 valueOf: function() {
21 throw new Test262Error();
22 }
23 };
24
25 assert.throws(Test262Error, function() {
26 new SharedArrayBuffer(len);
27 });
28
29 reportCompare(0, 0);