1 // Copyright (C) 2024 André Bargull. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
5 esid: sec-dataview-buffer-byteoffset-bytelength
7 The byteOffset argument is validated against the initial buffer length.
9 DataView ( buffer [ , byteOffset [ , byteLength ] ] )
12 3. Let offset be ? ToIndex(byteOffset).
14 5. Let bufferByteLength be ArrayBufferByteLength(buffer, seq-cst).
15 6. If offset > bufferByteLength, throw a RangeError exception.
17 10. Let O be ? OrdinaryCreateFromConstructor(NewTarget, "%DataView.prototype%",
18 « [[DataView]], [[ViewedArrayBuffer]], [[ByteLength]], [[ByteOffset]] »).
21 OrdinaryCreateFromConstructor ( constructor, intrinsicDefaultProto [ , internalSlotsList ] )
24 2. Let proto be ? GetPrototypeFromConstructor(constructor, intrinsicDefaultProto).
27 features: [Reflect.construct]
30 let newTarget = Object.defineProperty(function(){}.bind(), "prototype", {
32 throw new Test262Error("GetPrototypeFromConstructor not executed");
36 // Zero length buffer.
37 let ab = new ArrayBuffer(0);
39 // Byte offset is larger than the buffer length, which is zero.
42 assert.throws(RangeError, () => {
43 Reflect.construct(DataView, [ab, byteOffset], newTarget);