tests/auto/qml/ecmascripttests/test262/test/built-ins/Date/proto-from-ctor-realm-one.js
raw symbols SCIP| 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-date-value |
| 5 | es6id: 20.3.2.2 |
| 6 | description: Default [[Prototype]] value derived from realm of the newTarget |
| 7 | info: | |
| 8 | [...] |
| 9 | 3. If NewTarget is not undefined, then |
| 10 | [...] |
| 11 | c. Let O be ? OrdinaryCreateFromConstructor(NewTarget, |
| 12 | "%DatePrototype%", « [[DateValue]] »). |
| 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] |
| 24 | ---*/ |
| 25 | |
| 26 | var other = $262.createRealm().global; |
| 27 | var C = new other.Function(); |
| 28 | C.prototype = null; |
| 29 | |
| 30 | var o = Reflect.construct(Date, [0], C); |
| 31 | |
| 32 | assert.sameValue(Object.getPrototypeOf(o), other.Date.prototype); |