Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 5 | var handler = {}; |
| 6 | var target = { a: 1 }; |
| 7 | var proxy = new Proxy(target, handler); |
| 8 | |
| 9 | assertTrue(target.propertyIsEnumerable('a')); |
| 10 | assertTrue(proxy.propertyIsEnumerable('a')); |
| 11 | assertFalse(target.propertyIsEnumerable('b')); |
| 12 | assertFalse(proxy.propertyIsEnumerable('b')); |
| 13 | |
| 14 | handler.getOwnPropertyDescriptor = function(target, prop) { |
| 15 | return { configurable: true, enumerable: true, value: 10 }; |
| 16 | } |
| 17 | assertTrue(target.propertyIsEnumerable('a')); |
| 18 | assertTrue(proxy.propertyIsEnumerable('a')); |
| 19 | assertFalse(target.propertyIsEnumerable('b')); |
| 20 | assertTrue(proxy.propertyIsEnumerable('b')); |
| 21 | |
| 22 | handler.getOwnPropertyDescriptor = function(target, prop) { |
| 23 | return { configurable: true, enumerable: false, value: 10 }; |
| 24 | } |
| 25 | assertTrue(target.propertyIsEnumerable('a')); |
| 26 | assertFalse(proxy.propertyIsEnumerable('a')); |
| 27 | assertFalse(target.propertyIsEnumerable('b')); |
| 28 | assertFalse(proxy.propertyIsEnumerable('b')); |