OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --harmony-proxies --harmony-reflect | |
6 | |
7 | 5 |
8 (function () { | 6 (function () { |
9 // No trap. | 7 // No trap. |
10 | 8 |
11 var target = {}; | 9 var target = {}; |
12 var handler = {}; | 10 var handler = {}; |
13 var proxy = new Proxy(target, handler); | 11 var proxy = new Proxy(target, handler); |
14 | 12 |
15 assertTrue(Reflect.isExtensible(target)); | 13 assertTrue(Reflect.isExtensible(target)); |
16 assertTrue(Reflect.isExtensible(proxy)); | 14 assertTrue(Reflect.isExtensible(proxy)); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 var handler = { isExtensible() {return 0} }; | 63 var handler = { isExtensible() {return 0} }; |
66 var proxy = new Proxy(target, handler); | 64 var proxy = new Proxy(target, handler); |
67 | 65 |
68 // Trap returns falsish but target is extensible. | 66 // Trap returns falsish but target is extensible. |
69 assertThrows(() => {Reflect.isExtensible(proxy)}, TypeError); | 67 assertThrows(() => {Reflect.isExtensible(proxy)}, TypeError); |
70 | 68 |
71 // Trap returns falsish and target is not extensible. | 69 // Trap returns falsish and target is not extensible. |
72 Reflect.preventExtensions(target); | 70 Reflect.preventExtensions(target); |
73 assertFalse(Reflect.isExtensible(proxy)); | 71 assertFalse(Reflect.isExtensible(proxy)); |
74 })(); | 72 })(); |
OLD | NEW |