Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/DataView/excessive-byteoffset-throws-sab.js

raw
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // Copyright (C) 2017 Mozilla Corporation. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 es6id: 24.2.2.1
7 esid: sec-dataview-buffer-byteoffset-bytelength
8 description: >
9 Throws a RangeError if offset > bufferByteLength
10 info: |
11 24.2.2.1 DataView (buffer, byteOffset, byteLength )
12
13 ...
14 8. Let bufferByteLength be the value of buffer's [[ArrayBufferByteLength]]
15 internal slot.
16 9. If offset > bufferByteLength, throw a RangeError exception.
17 ...
18 features: [SharedArrayBuffer]
19 ---*/
20
21 var ab = new SharedArrayBuffer(1);
22
23 assert.throws(RangeError, function() {
24 new DataView(ab, 2);
25 }, "2");
26
27 assert.throws(RangeError, function() {
28 new DataView(ab, Infinity);
29 }, "Infinity");