Fix Object.assign to call [[GetOwnProperty]] Proxy handler only once (#3988)

Removed the enumerable option when listing properties to prevent an extra
[[GetOwnProperty]] function call for Proxy objects.
In this case all the property names are collected, but the Object.assign()
implementation has already taken care of the enumerable property filtering.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs@inf.u-szeged.hu
This commit is contained in:
Roland Takacs
2020-07-09 10:23:43 +02:00
committed by GitHub
parent ae5cfae3e7
commit 35e1e98008
2 changed files with 14 additions and 1 deletions
@@ -268,3 +268,17 @@ try {
}
// Step 17: See (Inv-2) above.
var result = [];
var proxy = new Proxy({foo: 1, bar: 2}, {
getOwnPropertyDescriptor: function(o, v) {
result.push(v);
return Object.getOwnPropertyDescriptor(o, v);
}
});
Object.assign({}, proxy);
assert(result.length === 2);
assert(result[0] === "foo");
assert(result[1] === "bar");