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

Unified Diff: test/mjsunit/harmony/proxies-get.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 side-by-side diff with in-line comments
Download patch
Index: test/mjsunit/harmony/proxies-get.js
diff --git a/test/mjsunit/harmony/proxies-get.js b/test/mjsunit/harmony/proxies-get.js
index 812739066e435aec1ad63a4553ff8eec1b6b0047..ab5af2a4bd7c0823f72071772e19af0e75d4938f 100644
--- a/test/mjsunit/harmony/proxies-get.js
+++ b/test/mjsunit/harmony/proxies-get.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-proxies
+// Flags: --harmony-proxies --harmony-reflect --allow-natives-syntax
(function testBasicFunctionality() {
var target = {
@@ -93,3 +93,37 @@
assertEquals("value", proxy.key2);
assertThrows(function(){ proxy.key3 }, TypeError);
})();
+
+(function testGetPrivateSymbol() {
+ var symbol = %CreatePrivateSymbol("secret");
+ var O = { [symbol]: "value" };
+ var proxy = new Proxy(O, { get(t, name) { assertUnreachable(); }});
+ assertEquals(undefined, proxy[symbol]);
+ assertEquals(undefined, Reflect.get(proxy, symbol));
+ assertEquals("value", O[symbol]);
+ assertEquals("value", Reflect.get(O, symbol));
+})();
+
+(function testGetInternalIterators() {
+ var log = [];
+ assertThrows(function() {
neis 2015/12/03 12:01:24 Can you move the assertThrows down to the line tha
+ var array = [1,2,3,4,5]
+ var origIt = array[Symbol.iterator]();
+ var it = new Proxy(origIt, {
+ get(t, name) {
+ log.push(`[[Get]](iterator, ${String(name)})`);
+ return Reflect.get(t, name);
+ },
+ set(t, name, val) {
+ log.push(`[[Set]](iterator, ${String(name)}, ${String(val)})`);
+ return Reflect.set(t, name, val);
+ }
+ });
+
+ for (var v of it) log.push(v);
+ }, TypeError);
+ assertEquals([
+ "[[Get]](iterator, Symbol(Symbol.iterator))",
+ "[[Get]](iterator, next)"
+ ], log);
+})();

Powered by Google App Engine
This is Rietveld 408576698