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

Unified Diff: test/mjsunit/harmony/proxies-enumerate.js

Issue 1516843002: [proxy] fixing harmony/proxy.js tests and improving error messages + some drive-by fixes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: WIP fix protoype walks with access checks 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-enumerate.js
diff --git a/test/mjsunit/harmony/proxies-enumerate.js b/test/mjsunit/harmony/proxies-enumerate.js
index 0da706d9e101f0814ba5c0dab2ed4f815fa78b67..82464d0c7fed29a3f6ec1a984aab8c9f03bb2833 100644
--- a/test/mjsunit/harmony/proxies-enumerate.js
+++ b/test/mjsunit/harmony/proxies-enumerate.js
@@ -72,3 +72,38 @@ TestNonStringKey({bad: "value"});
TestNonStringKey(null);
TestNonStringKey(undefined);
TestNonStringKey(true);
+
+(function testProtoProxyEnumerate() {
+ var keys = ['a', 'b', 'c', 'd'];
+ var handler = {
+ enumerate() { return keys[Symbol.iterator]() },
+ has(target, key) { return false }
+ };
+ var proxy = new Proxy({}, handler);
+ var seen_keys = [];
+ for (var i in proxy) {
+ seen_keys.push(i);
+ }
+ assertEquals([], seen_keys);
+
+ handler.has = function(target, key) { return true };
+ for (var i in proxy) {
+ seen_keys.push(i);
+ }
+ assertEquals(keys, seen_keys);
+
+ o = {__proto__:proxy};
+ handler.has = function(target, key) { return false };
+ seen_keys = [];
+ for (var i in o) {
+ seen_keys.push(i);
+ }
+ assertEquals([], seen_keys);
+
+ handler.has = function(target, key) { return true };
+ seen_keys = [];
+ for (var i in o) {
+ seen_keys.push(i);
+ }
+ assertEquals(keys, seen_keys);
+})();

Powered by Google App Engine
This is Rietveld 408576698