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

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

Issue 1717893002: Remove the Proxy enumerate trap (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix tests Created 4 years, 10 months 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
« no previous file with comments | « test/mjsunit/harmony/proxies-enumerate.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/proxies-for.js
diff --git a/test/mjsunit/harmony/proxies-for.js b/test/mjsunit/harmony/proxies-for.js
index aea9bd6c2144ba56aba2b91a109574bb8826348a..e52ee4303102a70a5bd57de7011910f69aaef80c 100644
--- a/test/mjsunit/harmony/proxies-for.js
+++ b/test/mjsunit/harmony/proxies-for.js
@@ -27,21 +27,15 @@
// Flags: --harmony-proxies
-
// Helper.
function TestWithProxies(test, x, y, z) {
test(function(h){ return new Proxy({}, h) }, x, y, z)
- test(function(h) {
- return new Proxy(function() {}, h)
- }, x, y, z)
}
// Iterate over a proxy.
-Array.prototype.values = function() { return this[Symbol.iterator]() }
-
function TestForIn(properties, handler) {
TestWithProxies(TestForIn2, properties, handler)
}
@@ -54,23 +48,18 @@ function TestForIn2(create, properties, handler) {
}
TestForIn(["0", "a"], {
- enumerate() { return ["0", "a"].values() },
- has(target, property) { return true }
+ ownKeys() { return ["0", "a"] },
+ has(target, property) { return true },
+ getOwnPropertyDescriptor() { return { enumerable: true, configurable: true }}
})
TestForIn(["null", "a"], {
- enumerate() { return this.enumerate2() },
- enumerate2() { return ["null", "a"].values() },
- has(target, property) { return true }
+ ownKeys() { return this.enumerate() },
+ enumerate() { return ["null", "a"] },
+ has(target, property) { return true },
+ getOwnPropertyDescriptor() { return { enumerable: true, configurable: true }}
})
-TestForIn(["b", "a", "0", "c"], new Proxy({}, {
- get: function(pr, pk) {
- return function() { return ["b", "a", "0", "c"].values() }
- }
-}))
-
-
// Iterate over an object with a proxy prototype.
@@ -94,19 +83,21 @@ function TestForInDerived2(create, properties, handler) {
}
TestForInDerived(["0", "a"], {
- enumerate: function() { return ["0", "a"].values() },
- has: function(t, k) { return k == "0" || k == "a" }
+ ownKeys: function() { return ["0", "a"] },
+ has: function(t, k) { return k == "0" || k == "a" },
+ getOwnPropertyDescriptor() { return { enumerable: true, configurable: true }}
})
TestForInDerived(["null", "a"], {
- enumerate: function() { return this.enumerate2() },
- enumerate2: function() { return ["null", "a"].values() },
- has: function(t, k) { return k == "null" || k == "a" }
+ ownKeys: function() { return this.enumerate() },
+ enumerate: function() { return ["null", "a"] },
+ has: function(t, k) { return k == "null" || k == "a" },
+ getOwnPropertyDescriptor() { return { enumerable: true, configurable: true }}
})
-// Throw exception in enumerate trap.
+// Throw exception in ownKeys trap.
function TestForInThrow(handler) {
TestWithProxies(TestForInThrow2, handler)
@@ -120,12 +111,12 @@ function TestForInThrow2(create, handler) {
}
TestForInThrow({
- enumerate: function() { throw "myexn" }
+ ownKeys: function() { throw "myexn" }
})
TestForInThrow({
- enumerate: function() { return this.enumerate2() },
- enumerate2: function() { throw "myexn" }
+ ownKeys: function() { return this.enumerate() },
+ enumerate: function() { throw "myexn" }
})
TestForInThrow(new Proxy({}, {
@@ -135,7 +126,7 @@ TestForInThrow(new Proxy({}, {
}));
(function() {
- var p = new Proxy({}, {enumerate:function() { return ["0"].values(); }});
+ var p = new Proxy({}, {ownKeys:function() { return ["0"]; }});
var o = [0];
o.__proto__ = p;
var keys = [];
« no previous file with comments | « test/mjsunit/harmony/proxies-enumerate.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698