Debian Codegraph @

js/src/tests/test262/built-ins/Proxy/construct/trap-is-undefined-proto-from-cross-realm-newtarget.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-proxy-object-internal-methods-and-internal-slots-construct-argumentslist-newtarget
5 description: >
6 If trap is undefined, propagate [[Construct]] to target,
7 passing correct newTarget parameter
8 info: |
9 [[Construct]] ( argumentsList, newTarget )
10
11 [...]
12 7. If trap is undefined, then
13 b. Return ? Construct(target, argumentsList, newTarget).
14
15 Construct ( F [ , argumentsList [ , newTarget ] ] )
16
17 [...]
18 5. Return ? F.[[Construct]](argumentsList, newTarget).
19
20 [[Construct]] ( argumentsList, newTarget )
21
22 [...]
23 5. If kind is "base", then
24 a. Let thisArgument be ? OrdinaryCreateFromConstructor(newTarget, "%ObjectPrototype%").
25
26 OrdinaryCreateFromConstructor ( constructor, intrinsicDefaultProto [ , internalSlotsList ] )
27
28 [...]
29 2. Let proto be ? GetPrototypeFromConstructor(constructor, intrinsicDefaultProto).
30 3. Return ObjectCreate(proto, internalSlotsList).
31
32 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto )
33
34 [...]
35 3. Let proto be ? Get(constructor, "prototype").
36 [...]
37 5. Return proto.
38 features: [cross-realm, Proxy, Reflect, Reflect.construct]
39 ---*/
40
41 var other = $262.createRealm().global;
42 var C = new other.Function();
43
44 var P = new Proxy(function() {}, {});
45 var p = Reflect.construct(P, [], C);
46
47 assert.sameValue(Object.getPrototypeOf(p), C.prototype);
48
49 reportCompare(0, 0);