Skip to content

Commit b74d582

Browse files
committed
address review comment
add test case for getPrototypeOf, and non-string values in ownKeys trap returning array
1 parent d283070 commit b74d582

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

test/es6/proxyenumremoval.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ var proxy = new Proxy({}, {
1414
for(var key in proxy);
1515

1616
// check ownKeys
17-
var proxy = new Proxy({x:1}, {
17+
var proxy = new Proxy({"5":1}, {
1818
ownKeys: function() {
19-
return ['a','b'];
19+
return ['a', {y:2}, 5, 'b', Symbol.iterator];
2020
}
2121
});
2222
var keys=""
@@ -26,7 +26,7 @@ passed &= keys==="";
2626
// check property descriptor
2727
var proxy = new Proxy({b:1,a:2}, {
2828
ownKeys: function() {
29-
return ['a','b'];
29+
return ['a', {y:2}, 5, 'b', Symbol.iterator];
3030
}
3131
});
3232
var keys=""
@@ -35,6 +35,7 @@ passed &= keys==="ab";
3535

3636
// check property descriptor trap
3737
var already_non_enmerable = false;
38+
var getPrototypeOfCalled = false;
3839
var proxy = new Proxy({}, {
3940
ownKeys: function() {
4041
return ['a','b','a']; // make first a non-enumerable, and second a enumerable, second a won't show up in for-in
@@ -52,11 +53,16 @@ var proxy = new Proxy({}, {
5253
value: 42,
5354
writable: true
5455
};
56+
},
57+
getPrototypeOf: function(){
58+
getPrototypeOfCalled = true;
59+
return null;
5560
}
5661
});
5762
var keys=""
5863
for(var key in proxy){ keys += key;}
5964
passed &= keys==="b";
65+
passed &= getPrototypeOfCalled;
6066

6167
if (passed) {
6268
WScript.Echo("PASS");

0 commit comments

Comments
 (0)