File: get-fn-realm.js

package info (click to toggle)
qtdeclarative-opensource-src-gles 5.15.17%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 258,992 kB
  • sloc: javascript: 512,415; cpp: 497,385; xml: 8,892; python: 3,304; ansic: 2,764; sh: 206; makefile: 46; php: 27
file content (29 lines) | stat: -rw-r--r-- 1,035 bytes parent folder | download | duplicates (11)
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);