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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 var handler = { preventExtensions() {return Symbol()} }; | 76 var handler = { preventExtensions() {return Symbol()} }; |
79 var proxy = new Proxy(target, handler); | 77 var proxy = new Proxy(target, handler); |
80 | 78 |
81 // Trap returns trueish but target is extensible. | 79 // Trap returns trueish but target is extensible. |
82 assertThrows(() => {Reflect.preventExtensions(proxy)}, TypeError); | 80 assertThrows(() => {Reflect.preventExtensions(proxy)}, TypeError); |
83 | 81 |
84 // Trap returns trueish and target is not extensible. | 82 // Trap returns trueish and target is not extensible. |
85 Reflect.preventExtensions(target); | 83 Reflect.preventExtensions(target); |
86 assertTrue(Reflect.preventExtensions(proxy)); | 84 assertTrue(Reflect.preventExtensions(proxy)); |
87 })(); | 85 })(); |
OLD | NEW |