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 var target = { | 5 var target = { |
8 "target_one": 1 | 6 "target_one": 1 |
9 }; | 7 }; |
10 target.__proto__ = { | 8 target.__proto__ = { |
11 "target_proto_two": 2 | 9 "target_proto_two": 2 |
12 }; | 10 }; |
13 var handler = { | 11 var handler = { |
14 ownKeys: function(target) { | 12 ownKeys: function(target) { |
15 return ["foo", "bar"]; | 13 return ["foo", "bar"]; |
16 } | 14 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 keys = ["nonconf", "target_one"]; | 85 keys = ["nonconf", "target_one"]; |
88 assertEquals(keys, Reflect.ownKeys(proxy)); | 86 assertEquals(keys, Reflect.ownKeys(proxy)); |
89 | 87 |
90 // Step 20: The trap result must not add keys to a non-extensible target. | 88 // Step 20: The trap result must not add keys to a non-extensible target. |
91 keys = ["nonconf", "target_one", "fantasy"]; | 89 keys = ["nonconf", "target_one", "fantasy"]; |
92 assertThrows("Reflect.ownKeys(proxy)", TypeError); | 90 assertThrows("Reflect.ownKeys(proxy)", TypeError); |
93 | 91 |
94 // Check that we allow duplicated keys. | 92 // Check that we allow duplicated keys. |
95 keys = ['nonconf', 'target_one', 'nonconf', 'nonconf', 'target_one',] | 93 keys = ['nonconf', 'target_one', 'nonconf', 'nonconf', 'target_one',] |
96 assertEquals(keys, Reflect.ownKeys(proxy)); | 94 assertEquals(keys, Reflect.ownKeys(proxy)); |
OLD | NEW |