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

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

Issue 1668853002: [proxies] allow duplicate keys for [[OwnPropertyKeys]] trap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
« src/objects.cc ('K') | « src/runtime/runtime-object.cc ('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-ownkeys.js
diff --git a/test/mjsunit/harmony/proxies-ownkeys.js b/test/mjsunit/harmony/proxies-ownkeys.js
index 6a7ae64d78b9602cf8bf579578ba4d98b46b4f6b..a2488e6d5253ab802049c072fcfb876843806c12 100644
--- a/test/mjsunit/harmony/proxies-ownkeys.js
+++ b/test/mjsunit/harmony/proxies-ownkeys.js
@@ -18,67 +18,80 @@ var handler = {
var proxy = new Proxy(target, handler);
-// Simple case.
-assertEquals(["foo", "bar"], Reflect.ownKeys(proxy));
+// // Simple case.
+// assertEquals(["foo", "bar"], Reflect.ownKeys(proxy));
-// Test interesting steps of the algorithm:
+// // Test interesting steps of the algorithm:
-// Step 6: Fall through to target.[[OwnPropertyKeys]] if the trap is undefined.
-handler.ownKeys = undefined;
-assertEquals(["target_one"], Reflect.ownKeys(proxy));
+// // Step 6: Fall through to target.[[OwnPropertyKeys]] if the trap is undefined.
+// handler.ownKeys = undefined;
+// assertEquals(["target_one"], Reflect.ownKeys(proxy));
-// Step 7: Throwing traps don't crash.
-handler.ownKeys = function(target) { throw 1; };
-assertThrows("Reflect.ownKeys(proxy)");
+// // Step 7: Throwing traps don't crash.
+// handler.ownKeys = function(target) { throw 1; };
+// assertThrows("Reflect.ownKeys(proxy)");
-// Step 8: CreateListFromArrayLike error cases:
-// Returning a non-Object throws.
+// // Step 8: CreateListFromArrayLike error cases:
+// // Returning a non-Object throws.
var keys = 1;
handler.ownKeys = function(target) { return keys; };
-assertThrows("Reflect.ownKeys(proxy)", TypeError);
-keys = "string";
-assertThrows("Reflect.ownKeys(proxy)", TypeError);
-keys = Symbol("foo");
-assertThrows("Reflect.ownKeys(proxy)", TypeError);
-keys = null;
-assertThrows("Reflect.ownKeys(proxy)", TypeError);
-
-// "length" property is honored.
-keys = { 0: "a", 1: "b", 2: "c" };
-keys.length = 0;
-assertEquals([], Reflect.ownKeys(proxy));
-keys.length = 1;
-assertEquals(["a"], Reflect.ownKeys(proxy));
-keys.length = 3;
-assertEquals(["a", "b", "c"], Reflect.ownKeys(proxy));
-// The spec wants to allow lengths up to 2^53, but we can't allocate arrays
-// of that size, so we throw even for smaller values.
-keys.length = Math.pow(2, 33);
-assertThrows("Reflect.ownKeys(proxy)", RangeError);
-
-// Non-Name results throw.
-keys = [1];
-assertThrows("Reflect.ownKeys(proxy)", TypeError);
-keys = [{}];
-assertThrows("Reflect.ownKeys(proxy)", TypeError);
-keys = [{toString: function() { return "foo"; }}];
-assertThrows("Reflect.ownKeys(proxy)", TypeError);
-keys = [null];
-assertThrows("Reflect.ownKeys(proxy)", TypeError);
+// assertThrows("Reflect.ownKeys(proxy)", TypeError);
+// keys = "string";
+// assertThrows("Reflect.ownKeys(proxy)", TypeError);
+// keys = Symbol("foo");
+// assertThrows("Reflect.ownKeys(proxy)", TypeError);
+// keys = null;
+// assertThrows("Reflect.ownKeys(proxy)", TypeError);
+
+// // "length" property is honored.
+// keys = { 0: "a", 1: "b", 2: "c" };
+// keys.length = 0;
+// assertEquals([], Reflect.ownKeys(proxy));
+// keys.length = 1;
+// assertEquals(["a"], Reflect.ownKeys(proxy));
+// keys.length = 3;
+// assertEquals(["a", "b", "c"], Reflect.ownKeys(proxy));
+// // The spec wants to allow lengths up to 2^53, but we can't allocate arrays
+// // of that size, so we throw even for smaller values.
+// keys.length = Math.pow(2, 33);
+// assertThrows("Reflect.ownKeys(proxy)", RangeError);
+
+// Check that we allow duplicated keys.
+keys = ['a', 'a', 'a']
+// assertEquals(keys, Reflect.ownKeys(proxy));
+
+// // Non-Name results throw.
+// keys = [1];
+// assertThrows("Reflect.ownKeys(proxy)", TypeError);
+// keys = [{}];
+// assertThrows("Reflect.ownKeys(proxy)", TypeError);
+// keys = [{toString: function() { return "foo"; }}];
+// assertThrows("Reflect.ownKeys(proxy)", TypeError);
+// keys = [null];
+// assertThrows("Reflect.ownKeys(proxy)", TypeError);
// Step 17a: The trap result must include all non-configurable keys.
Object.defineProperty(target, "nonconf", {value: 1, configurable: false});
-keys = ["foo"];
-assertThrows("Reflect.ownKeys(proxy)", TypeError);
-keys = ["nonconf"];
-assertEquals(keys, Reflect.ownKeys(proxy));
+// keys = ["foo"];
+// assertThrows("Reflect.ownKeys(proxy)", TypeError);
+// keys = ["nonconf"];
+// assertEquals(keys, Reflect.ownKeys(proxy));
+
+// // Check that we allow duplicated keys.
+// keys = ['nonconf', 'nonconf', 'nonconf']
+// assertEquals(keys, Reflect.ownKeys(proxy));
// Step 19a: The trap result must all keys of a non-extensible target.
Object.preventExtensions(target);
-assertThrows("Reflect.ownKeys(proxy)", TypeError);
-keys = ["nonconf", "target_one"];
-assertEquals(keys, Reflect.ownKeys(proxy));
+// assertThrows("Reflect.ownKeys(proxy)", TypeError);
+// keys = ["nonconf", "target_one"];
+// assertEquals(keys, Reflect.ownKeys(proxy));
+
+// // Step 20: The trap result must not add keys to a non-extensible target.
+// keys = ["nonconf", "target_one", "fantasy"];
+// assertThrows("Reflect.ownKeys(proxy)", TypeError);
-// Step 20: The trap result must not add keys to a non-extensible target.
-keys = ["nonconf", "target_one", "fantasy"];
-assertThrows("Reflect.ownKeys(proxy)", TypeError);
+
+// Check that we allow duplicated keys.
+keys = ['nonconf', 'target_one', 'nonconf', 'nonconf', 'target_one',]
+assertEquals(keys, Reflect.ownKeys(proxy));
« src/objects.cc ('K') | « src/runtime/runtime-object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698