Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / Array / from / proto-from-ctor-realm.js
blob2debc14d0241a868d12ebb6bba2d68a391a5b909
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.from
5 es6id: 22.1.2.1
6 description: Default [[Prototype]] value derived from realm of the constructor
7 info: |
8     [...]
9     5. If usingIterator is not undefined, then
10        a. If IsConstructor(C) is true, then
11           i. Let A be ? Construct(C).
12     [...]
14     9.1.14 GetPrototypeFromConstructor
16     [...]
17     3. Let proto be ? Get(constructor, "prototype").
18     4. If Type(proto) is not Object, then
19        a. Let realm be ? GetFunctionRealm(constructor).
20        b. Let proto be realm's intrinsic object named intrinsicDefaultProto.
21     [...]
22 features: [cross-realm]
23 ---*/
25 var other = $262.createRealm().global;
26 var C = new other.Function();
27 C.prototype = null;
29 var a = Array.from.call(C, []);
31 assert.sameValue(
32   Object.getPrototypeOf(a),
33   other.Object.prototype,
34   'Object.getPrototypeOf(Array.from.call(C, [])) returns other.Object.prototype'
37 reportCompare(0, 0);