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

Unified Diff: test/mjsunit/harmony/proxies-define-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 side-by-side diff with in-line comments
Download patch
Index: test/mjsunit/harmony/proxies-define-property.js
diff --git a/test/mjsunit/harmony/proxies-define-property.js b/test/mjsunit/harmony/proxies-define-property.js
index 78ab85e8a4c3ff8a0fc35fa2a1eee8472e231262..75e8f0d2b0430a4556e22dcaf12ad94d9927a150 100644
--- a/test/mjsunit/harmony/proxies-define-property.js
+++ b/test/mjsunit/harmony/proxies-define-property.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
// Check basic call to trap.
@@ -73,3 +73,22 @@ assertThrows("Object.defineProperty(proxy, 'foo', {value: 2})", TypeError);
target.bar = "baz";
assertThrows("Object.defineProperty(proxy, 'bar', {configurable: false})",
TypeError);
+
+(function testDefinePrivateSymbol() {
+ var symbol = %CreatePrivateSymbol("secret");
+ var O = {};
+ Object.defineProperty(O, symbol, { value: "value", configurable: true });
+ assertEquals("value", O[symbol]);
+ var proxy = new Proxy(O, { defineProperty(t, n, d) { assertUnreachable(); }});
+ Object.defineProperty(O, symbol, { value: "value", configurable: true });
+ assertEquals(undefined, proxy[symbol]);
+ assertEquals(undefined, Reflect.get(proxy, symbol));
+
+ assertEquals(
+ true, Reflect.defineProperty(O, symbol,
+ { value: "value2", configurable: true }));
neis 2015/12/03 12:01:24 assertTrue
+
+ assertEquals(
+ false, Reflect.defineProperty(proxy, symbol,
+ { value: "value2", configurable: true }));
+})();
neis 2015/12/03 12:01:24 assertFalse

Powered by Google App Engine
This is Rietveld 408576698