Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Function/internals/Construct/base-ctor-revoked-proxy.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-ecmascript-function-objects-construct-argumentslist-newtarget
5 es6id: 9.2.2
6 description: Error retrieving function realm from revoked Proxy exotic object
7 info: |
8 [...]
9 5. If kind is "base", then
10 a. Let thisArgument be ? OrdinaryCreateFromConstructor(newTarget,
11 "%ObjectPrototype%").
12 [...]
13
14 9.1.13 OrdinaryCreateFromConstructor
15
16 [...]
17 2. Let proto be ? GetPrototypeFromConstructor(constructor,
18 intrinsicDefaultProto).
19 [...]
20
21 9.1.14 GetPrototypeFromConstructor
22
23 [...]
24 3. Let proto be ? Get(constructor, "prototype").
25 4. If Type(proto) is not Object, then
26 a. Let realm be ? GetFunctionRealm(constructor).
27
28 7.3.22 GetFunctionRealm
29
30 [...]
31 2. If obj has a [[Realm]] internal slot, then
32 [...]
33 3. If obj is a Bound Function exotic object, then
34 [...]
35 4. If obj is a Proxy exotic object, then
36 a. If the value of the [[ProxyHandler]] internal slot of obj is null,
37 throw a TypeError exception.
38 features: [Proxy]
39 ---*/
40
41 // Defer proxy revocation until after the `constructor` property has been
42 // accessed
43 var handlers = {
44 get: function() {
45 handle.revoke();
46 }
47 };
48 var handle = Proxy.revocable(function() {}, handlers);
49 var f = handle.proxy;
50
51 assert.sameValue(typeof f, 'function');
52
53 assert.throws(TypeError, function() {
54 new f();
55 });