Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/DataView/custom-proto-access-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 Return abrupt from newTarget's custom constructor prototype
9 info: |
10 24.2.2.1 DataView (buffer, byteOffset, byteLength )
11
12 ...
13 12. Let O be ? OrdinaryCreateFromConstructor(NewTarget, "%DataViewPrototype%",
14 « [[DataView]], [[ViewedArrayBuffer]], [[ByteLength]], [[ByteOffset]] »).
15 ...
16 17. Return O.
17
18 9.1.13 OrdinaryCreateFromConstructor ( constructor, intrinsicDefaultProto [ ,
19 internalSlotsList ] )
20
21 ...
22 2. Let proto be ? GetPrototypeFromConstructor(constructor,
23 intrinsicDefaultProto).
24 3. Return ObjectCreate(proto, internalSlotsList).
25
26 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto )
27
28 ...
29 3. Let proto be ? Get(constructor, "prototype").
30 ...
31 features: [Reflect.construct]
32 ---*/
33
34 var buffer = new ArrayBuffer(8);
35
36 var newTarget = function() {}.bind(null);
37 Object.defineProperty(newTarget, "prototype", {
38 get() {
39 throw new Test262Error();
40 }
41 });
42
43 assert.throws(Test262Error, function() {
44 Reflect.construct(DataView, [buffer, 0], newTarget);
45 });