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