Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / RegExp / proto-from-ctor-realm.js
blob2b38b40f9517be2d9b595c30f8b67fd3c11dab85
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-boolean-constructor-boolean-value
5 description: Default [[Prototype]] value derived from realm of the newTarget
6 info: |
7     [...]
8     2. If NewTarget is not undefined, let newTarget be NewTarget.
9     [...]
10     7. Let O be ? RegExpAlloc(newTarget).
11     [...]
13     9.1.14 GetPrototypeFromConstructor
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 ---*/
24 var other = $262.createRealm().global;
25 var C = new other.Function();
26 C.prototype = null;
28 var o = Reflect.construct(RegExp, [], C);
30 assert.sameValue(Object.getPrototypeOf(o), other.RegExp.prototype);
32 reportCompare(0, 0);