| 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-getfunctionrealm |
| 5 |
es6id: 7.3.22 |
| 6 |
description: > |
| 7 |
The realm of a proxy exotic object is the realm of its target function |
| 8 |
info: | |
| 9 |
[...] |
| 10 |
2. If obj has a [[Realm]] internal slot, then |
| 11 |
a, Return obj's [[Realm]] internal slot. |
| 12 |
3. If obj is a Bound Function exotic object, then |
| 13 |
[...] |
| 14 |
4. If obj is a Proxy exotic object, then |
| 15 |
a. If the value of the [[ProxyHandler]] internal slot of obj is null, |
| 16 |
throw a TypeError exception. |
| 17 |
b. Let proxyTarget be the value of obj's [[ProxyTarget]] internal slot. |
| 18 |
c. Return ? GetFunctionRealm(proxyTarget). |
| 19 |
features: [cross-realm] |
| 20 |
---*/ |
| 21 |
|
| 22 |
var other = $262.createRealm().global; |
| 23 |
var C = new other.Function(); |
| 24 |
// Ensure that the proxy does not report a `prototype` property |
| 25 |
var P = new Proxy(C, { |
| 26 |
get: function() {} |
| 27 |
}); |
| 28 |
|
| 29 |
assert.sameValue(Object.getPrototypeOf(new P()), other.Object.prototype); |