blob: 0d4a92f1b6b63c1d1fa1ce5de591c23a9b254361 [file] [log] [blame]
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001// 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 Murdoch4a90d5f2016-03-22 12:00:34 +00005var handler = {};
6var target = { a: 1 };
7var proxy = new Proxy(target, handler);
8
9assertTrue(target.propertyIsEnumerable('a'));
10assertTrue(proxy.propertyIsEnumerable('a'));
11assertFalse(target.propertyIsEnumerable('b'));
12assertFalse(proxy.propertyIsEnumerable('b'));
13
14handler.getOwnPropertyDescriptor = function(target, prop) {
15 return { configurable: true, enumerable: true, value: 10 };
16}
17assertTrue(target.propertyIsEnumerable('a'));
18assertTrue(proxy.propertyIsEnumerable('a'));
19assertFalse(target.propertyIsEnumerable('b'));
20assertTrue(proxy.propertyIsEnumerable('b'));
21
22handler.getOwnPropertyDescriptor = function(target, prop) {
23 return { configurable: true, enumerable: false, value: 10 };
24}
25assertTrue(target.propertyIsEnumerable('a'));
26assertFalse(proxy.propertyIsEnumerable('a'));
27assertFalse(target.propertyIsEnumerable('b'));
28assertFalse(proxy.propertyIsEnumerable('b'));