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

Side by Side Diff: test/mjsunit/harmony/proxies-delete-property.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 --harmony-reflect 5 // Flags: --harmony-proxies --harmony-reflect --allow-natives-syntax
6 6
7 7
8 var properties = 8 var properties =
9 ["bla", "0", 1, Symbol(), {[Symbol.toPrimitive]() {return "a"}}]; 9 ["bla", "0", 1, Symbol(), {[Symbol.toPrimitive]() {return "a"}}];
10 10
11 11
12 function TestForwarding(handler, myDelete, shouldThrow) { 12 function TestForwarding(handler, myDelete, shouldThrow) {
13 var target = {}; 13 var target = {};
14 var proxy = new Proxy(target, handler); 14 var proxy = new Proxy(target, handler);
15 15
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 181
182 182
183 TestTrappingFalsish( 183 TestTrappingFalsish(
184 (o, p) => delete o[p], false); 184 (o, p) => delete o[p], false);
185 TestTrappingFalsish( 185 TestTrappingFalsish(
186 (o, p) => Reflect.deleteProperty(o, p), false); 186 (o, p) => Reflect.deleteProperty(o, p), false);
187 TestTrappingFalsish( 187 TestTrappingFalsish(
188 (o, p) => {"use strict"; return delete o[p]}, true); 188 (o, p) => {"use strict"; return delete o[p]}, true);
189 TestTrappingFalsish( 189 TestTrappingFalsish(
190 (o, p) => {"use strict"; return Reflect.deleteProperty(o, p)}, false); 190 (o, p) => {"use strict"; return Reflect.deleteProperty(o, p)}, false);
191
192 (function testDeletePrivateSymbol() {
193 var symbol = %CreatePrivateSymbol("secret");
194 var O = { [symbol]: "value" };
195 var proxy = new Proxy(O, { delete(t, name) { assertUnreachable(); }});
196 delete proxy[symbol];
197 assertEquals(true, Reflect.deleteProperty(proxy, symbol));
198 assertEquals("value", O[symbol]);
199 assertEquals(true, Reflect.deleteProperty(O, symbol));
200 assertEquals(undefined, O[symbol]);
201 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698