Debian Codegraph @

js/src/tests/test262/built-ins/Proxy/preventExtensions/trap-is-missing-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 target = new Proxy({}, {
21 preventExtensions: function(_target) {
22 return false;
23 },
24 });
25
26 var proxy = new Proxy(target, {});
27
28 assert.throws(TypeError, function() {
29 Object.preventExtensions(proxy);
30 });
31
32 reportCompare(0, 0);