Debian Codegraph @

js/src/tests/test262/built-ins/WeakSet/proto-from-ctor-realm.js

raw
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-weakset-iterable
5 description: Default [[Prototype]] value derived from realm of the newTarget
6 info: |
7 [...]
8 2. Let set be ? OrdinaryCreateFromConstructor(NewTarget,
9 "%WeakSetPrototype%", « [[WeakSetData]] »).
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, Reflect]
21 ---*/
22
23 var other = $262.createRealm().global;
24 var C = new other.Function();
25 C.prototype = null;
26
27 var o = Reflect.construct(WeakSet, [], C);
28
29 assert.sameValue(Object.getPrototypeOf(o), other.WeakSet.prototype);
30
31 reportCompare(0, 0);