| 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 | 5 // Flags: --harmony-proxies --harmony-reflect --allow-natives-syntax |
| 6 | 6 |
| 7 var target = { | 7 var target = { |
| 8 "target_one": 1 | 8 "target_one": 1 |
| 9 }; | 9 }; |
| 10 target.__proto__ = { | 10 target.__proto__ = { |
| 11 "target_two": 2 | 11 "target_two": 2 |
| 12 }; | 12 }; |
| 13 var handler = { | 13 var handler = { |
| 14 has: function(target, name) { | 14 has: function(target, name) { |
| 15 return name == "present"; | 15 return name == "present"; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 result = false; | 47 result = false; |
| 48 assertThrows("'nonconf' in proxy", TypeError); | 48 assertThrows("'nonconf' in proxy", TypeError); |
| 49 | 49 |
| 50 // Step 9b iii. Trap result must confirm presence of all own properties of | 50 // Step 9b iii. Trap result must confirm presence of all own properties of |
| 51 // non-extensible targets. | 51 // non-extensible targets. |
| 52 Object.freeze(target); | 52 Object.freeze(target); |
| 53 assertThrows("'nonconf' in proxy", TypeError); | 53 assertThrows("'nonconf' in proxy", TypeError); |
| 54 assertThrows("'target_one' in proxy", TypeError); | 54 assertThrows("'target_one' in proxy", TypeError); |
| 55 assertFalse("target_two" in proxy); | 55 assertFalse("target_two" in proxy); |
| 56 assertFalse("in_your_dreams" in proxy); | 56 assertFalse("in_your_dreams" in proxy); |
| 57 |
| 58 (function testHasPrivateSymbol() { |
| 59 var symbol = %CreatePrivateSymbol("secret"); |
| 60 var O = {}; |
| 61 var proxy = new Proxy(O, { has(t, name) { assertUnreachable(); }}); |
| 62 O[symbol] = "value"; |
| 63 proxy[symbol] = "value"; |
| 64 assertEquals(false, symbol in proxy); |
| 65 assertEquals(false, Reflect.has(proxy, symbol)); |
| 66 assertEquals(true, symbol in O); |
| 67 assertEquals(true, Reflect.has(O, symbol)); |
| 68 })(); |
| OLD | NEW |