mirror of
https://github.com/tc39/test262.git
synced 2025-04-08 19:35:28 +02:00
* [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time)
33 lines
897 B
JavaScript
33 lines
897 B
JavaScript
function test() {
|
|
|
|
var symbol = Symbol("test");
|
|
var proxy = new Proxy({}, {
|
|
getOwnPropertyDescriptor(t, n) {
|
|
// Required to prevent Object.keys() from discarding results
|
|
return {
|
|
enumerable: true,
|
|
configurable: true
|
|
};
|
|
},
|
|
ownKeys: function (t) {
|
|
return ["A", "A", "0", "0", symbol, symbol];
|
|
}
|
|
});
|
|
var keys = Object.keys(proxy);
|
|
var names = Object.getOwnPropertyNames(proxy);
|
|
var symbols = Object.getOwnPropertySymbols(proxy);
|
|
|
|
if (keys.length === 4 && keys[0] === keys[1] && keys[2] === keys[3] &&
|
|
keys[0] === "A" && keys[2] === "0" &&
|
|
names.length === 4 && names[0] === names[1] && names[2] === names[3] &&
|
|
names[0] === "A" && names[2] === "0" &&
|
|
symbols.length === 2 && symbols[0] === symbols[1] && symbols[0] === symbol)
|
|
return true;
|
|
return false;
|
|
|
|
}
|
|
|
|
if (!test())
|
|
throw new Error("Test failed");
|
|
|