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