summaryrefslogtreecommitdiff
path: root/test/built-ins/Proxy/get-fn-realm.js
blob: 922a6ffd0dc8bdd308eba3c728e7531dc706e80c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-getfunctionrealm
es6id: 7.3.22
description: >
    The realm of a proxy exotic object is the realm of its target function
info: |
    [...]
    2. If obj has a [[Realm]] internal slot, then
       a, Return obj's [[Realm]] internal slot.
    3. If obj is a Bound Function exotic object, then
       [...]
    4. If obj is a Proxy exotic object, then
       a. If the value of the [[ProxyHandler]] internal slot of obj is null,
          throw a TypeError exception.
       b. Let proxyTarget be the value of obj's [[ProxyTarget]] internal slot.
       c. Return ? GetFunctionRealm(proxyTarget).
features: [cross-realm]
---*/

var other = $262.createRealm().global;
var C = new other.Function();
// Ensure that the proxy does not report a `prototype` property
var P = new Proxy(C, {
  get: function() {}
});

assert.sameValue(Object.getPrototypeOf(new P()), other.Object.prototype);