Debian Codegraph @

js/src/tests/test262/built-ins/Proxy/preventExtensions/trap-is-null-target-is-proxy.js

raw
1 // Copyright (C) 2020 Alexey Shvayka. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-proxy-object-internal-methods-and-internal-slots-preventextensions
6 description: >
7 If "preventExtensions" trap is null or undefined, [[PreventExtensions]] call
8 is properly forwarded to [[ProxyTarget]] (which is also a Proxy object).
9 info: |
10 [[PreventExtensions]] ( )
11
12 [...]
13 4. Let target be O.[[ProxyTarget]].
14 5. Let trap be ? GetMethod(handler, "preventExtensions").
15 6. If trap is undefined, then
16 a. Return ? target.[[PreventExtensions]]().
17 features: [Proxy]
18 ---*/
19
20 var plainObject = {};
21 var plainObjectTarget = new Proxy(plainObject, {});
22 var plainObjectProxy = new Proxy(plainObjectTarget, {
23 preventExtensions: null,
24 });
25
26 Object.preventExtensions(plainObjectProxy);
27 assert(!Object.isExtensible(plainObject));
28
29 reportCompare(0, 0);