proto-from-ctor-realm.js (984B)
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-array.of 5 description: Default [[Prototype]] value derived from realm of the constructor 6 info: | 7 [...] 8 4. If IsConstructor(C) is true, then 9 a. Let A be ? Construct(C, « len »). 10 [...] 11 12 9.1.14 GetPrototypeFromConstructor 13 14 [...] 15 3. Let proto be ? Get(constructor, "prototype"). 16 4. If Type(proto) is not Object, then 17 a. Let realm be ? GetFunctionRealm(constructor). 18 b. Let proto be realm's intrinsic object named intrinsicDefaultProto. 19 [...] 20 features: [cross-realm] 21 ---*/ 22 23 var other = $262.createRealm().global; 24 var C = new other.Function(); 25 C.prototype = null; 26 27 var a = Array.of.call(C, 1, 2, 3); 28 29 assert.sameValue( 30 Object.getPrototypeOf(a), 31 other.Object.prototype, 32 'Object.getPrototypeOf(Array.of.call(C, 1, 2, 3)) returns other.Object.prototype' 33 ); 34 35 reportCompare(0, 0);