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 | |
6 | |
7 var target = { | 5 var target = { |
8 target: 1 | 6 target: 1 |
9 }; | 7 }; |
10 target.__proto__ = { | 8 target.__proto__ = { |
11 target_proto: 2 | 9 target_proto: 2 |
12 }; | 10 }; |
13 | 11 |
14 var handler = { | 12 var handler = { |
15 ownKeys: function(target) { | 13 ownKeys: function(target) { |
16 return ["foo", "bar", Symbol("baz"), "non-enum", "not-found"]; | 14 return ["foo", "bar", Symbol("baz"), "non-enum", "not-found"]; |
(...skipping 15 matching lines...) Expand all Loading... |
32 assertEquals([], Object.keys(proxy)); | 30 assertEquals([], Object.keys(proxy)); |
33 | 31 |
34 // Throwing shouldn't crash. | 32 // Throwing shouldn't crash. |
35 handler.getOwnPropertyDescriptor = function() { throw new Number(1); }; | 33 handler.getOwnPropertyDescriptor = function() { throw new Number(1); }; |
36 assertThrows("Object.keys(proxy)", Number); | 34 assertThrows("Object.keys(proxy)", Number); |
37 | 35 |
38 // Fall through to target if there is no trap. | 36 // Fall through to target if there is no trap. |
39 handler.ownKeys = undefined; | 37 handler.ownKeys = undefined; |
40 assertEquals(["target"], Object.keys(proxy)); | 38 assertEquals(["target"], Object.keys(proxy)); |
41 assertEquals(["target"], Object.keys(target)); | 39 assertEquals(["target"], Object.keys(target)); |
OLD | NEW |