Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Side by Side Diff: test/mjsunit/harmony/proxies-has.js

Issue 1492923002: [proxies] do not leak private symbols to proxy traps (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: More tests + cleanup fix Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698