Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/DataView/proto-from-ctor-realm.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 esid: sec-dataview-buffer-byteoffset-bytelength
5 es6id: 24.2.2.1
6 description: Default [[Prototype]] value derived from realm of the newTarget
7 info: |
8 [...]
9 12. Let O be ? OrdinaryCreateFromConstructor(NewTarget,
10 "%DataViewPrototype%", « [[DataView]], [[ViewedArrayBuffer]],
11 [[ByteLength]], [[ByteOffset]] »).
12 [...]
13
14 9.1.14 GetPrototypeFromConstructor
15
16 [...]
17 3. Let proto be ? Get(constructor, "prototype").
18 4. If Type(proto) is not Object, then
19 a. Let realm be ? GetFunctionRealm(constructor).
20 b. Let proto be realm's intrinsic object named intrinsicDefaultProto.
21 [...]
22 features: [cross-realm, Reflect]
23 ---*/
24
25 var other = $262.createRealm().global;
26 var C = new other.Function();
27 C.prototype = null;
28 var buffer = new ArrayBuffer(0);
29
30 var o = Reflect.construct(DataView, [buffer, 0], C);
31
32 assert.sameValue(Object.getPrototypeOf(o), other.DataView.prototype);