| Index: test/mjsunit/harmony/proxies.js
|
| diff --git a/test/mjsunit/harmony/proxies.js b/test/mjsunit/harmony/proxies.js
|
| index 490877c05fa03ab74bd088950cd7c6727f842eb8..4d27c8e604887e1a83fc7126b14541307c5927ec 100644
|
| --- a/test/mjsunit/harmony/proxies.js
|
| +++ b/test/mjsunit/harmony/proxies.js
|
| @@ -309,7 +309,7 @@ TestPrototype()
|
|
|
|
|
|
|
| -// Property names (Object.getOwnPropertyNames).
|
| +// Property names (Object.getOwnPropertyNames, Object.keys).
|
|
|
| function TestPropertyNames(names, handler) {
|
| var p = Proxy.create(handler)
|
| @@ -331,3 +331,51 @@ TestPropertyNames(["[object Object]"], {
|
| return function() { return [{}] }
|
| }
|
| })
|
| +
|
| +
|
| +function TestKeys(names, handler) {
|
| + var p = Proxy.create(handler)
|
| + assertArrayEquals(names, Object.keys(p))
|
| +}
|
| +
|
| +TestKeys([], {
|
| + keys: function() { return [] }
|
| +})
|
| +TestKeys(["a", "zz", " ", "0"], {
|
| + keys: function() { return ["a", "zz", " ", 0] }
|
| +})
|
| +TestKeys(["throw", "function "], {
|
| + keys: function() { return this.keys2() },
|
| + keys2: function() { return ["throw", "function "] }
|
| +})
|
| +TestKeys(["[object Object]"], {
|
| + get keys() {
|
| + return function() { return [{}] }
|
| + }
|
| +})
|
| +TestKeys(["a", "0"], {
|
| + getOwnPropertyNames: function() { return ["a", 23, "zz", "", 0] },
|
| + getOwnPropertyDescriptor: function(k) { return {enumerable: k.length == 1} }
|
| +})
|
| +TestKeys(["23", "zz", ""], {
|
| + getOwnPropertyNames: function() { return this.getOwnPropertyNames2() },
|
| + getOwnPropertyNames2: function() { return ["a", 23, "zz", "", 0] },
|
| + getOwnPropertyDescriptor: function(k) {
|
| + return this.getOwnPropertyDescriptor2(k)
|
| + },
|
| + getOwnPropertyDescriptor2: function(k) { return {enumerable: k.length != 1} }
|
| +})
|
| +TestKeys(["a", "b", "c", "5"], {
|
| + get getOwnPropertyNames() {
|
| + return function() { return ["0", 4, "a", "b", "c", 5] }
|
| + },
|
| + get getOwnPropertyDescriptor() {
|
| + return function(k) { return {enumerable: k >= "44"} }
|
| + }
|
| +})
|
| +TestKeys([], {
|
| + get getOwnPropertyNames() {
|
| + return function() { return ["a", "b", "c"] }
|
| + },
|
| + getOwnPropertyDescriptor: function(k) { return {} }
|
| +})
|
|
|