Debian Codegraph @

js/src/tests/test262/built-ins/DataView/return-abrupt-tonumber-bytelength-symbol-sab.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-dataview-buffer-byteoffset-bytelength
8 description: >
9 Return abrupt from ToLength(symbol byteLength)
10 info: |
11 24.2.2.1 DataView (buffer, byteOffset, byteLength )
12
13 ...
14 10. If byteLength is undefined, then
15 a. Let viewByteLength be bufferByteLength - offset.
16 11. Else,
17 a. Let viewByteLength be ? ToLength(byteLength).
18 ...
19 features: [SharedArrayBuffer, Symbol]
20 ---*/
21
22 var buffer = new SharedArrayBuffer(8);
23 var s = Symbol("1");
24
25 assert.throws(TypeError, function() {
26 new DataView(buffer, 0, s);
27 });
28
29 reportCompare(0, 0);