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

Side by Side Diff: test/mjsunit/harmony/proxies-set.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 function sloppyDefaultSet(o, p, v) { return o[p] = v } 8 function sloppyDefaultSet(o, p, v) { return o[p] = v }
9 function sloppyReflectSet(o, p, v) { return Reflect.set(o, p, v) } 9 function sloppyReflectSet(o, p, v) { return Reflect.set(o, p, v) }
10 function strictDefaultSet(o, p, v) { "use strict"; return o[p] = v } 10 function strictDefaultSet(o, p, v) { "use strict"; return o[p] = v }
11 function strictReflectSet(o, p, v) { "use strict"; return Reflect.set(o, p, v) } 11 function strictReflectSet(o, p, v) { "use strict"; return Reflect.set(o, p, v) }
12 12
13 sloppyDefaultSet.shouldThrow = false; 13 sloppyDefaultSet.shouldThrow = false;
14 sloppyReflectSet.shouldThrow = false; 14 sloppyReflectSet.shouldThrow = false;
15 strictDefaultSet.shouldThrow = true; 15 strictDefaultSet.shouldThrow = true;
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 for (var receiver of [null, undefined, 1]) { 303 for (var receiver of [null, undefined, 1]) {
304 Reflect.set(object, p, 42, receiver); 304 Reflect.set(object, p, 42, receiver);
305 assertEquals(1, observations.length); 305 assertEquals(1, observations.length);
306 assertArrayEquals([target, toKey(p), 42, receiver], observations[0]); 306 assertArrayEquals([target, toKey(p), 42, receiver], observations[0]);
307 assertSame(target, observations[0][0]); 307 assertSame(target, observations[0][0]);
308 assertSame(receiver, observations[0][3]); 308 assertSame(receiver, observations[0][3]);
309 observations = []; 309 observations = [];
310 } 310 }
311 } 311 }
312 })(); 312 })();
313
314
315 (function testSetPrivateSymbol() {
316 var symbol = %CreatePrivateSymbol("secret");
317 var O = {};
318 var proxy = new Proxy(O, { set(t, name, val) { assertUnreachable(); }});
319 O[symbol] = "value";
320 proxy[symbol] = "value";
321 assertEquals(undefined, proxy[symbol]);
322 assertEquals(false, Reflect.set(proxy, symbol, "otherValue"));
323 assertEquals("value", O[symbol]);
324 assertEquals(true, Reflect.set(O, symbol, "otherValue"));
325 })();
OLDNEW
« test/mjsunit/harmony/proxies-get.js ('K') | « test/mjsunit/harmony/proxies-has.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698