Debian Codegraph @

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

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