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