Closed
Description
- Version: 6.3.1 and 6.4
- Platform: Arch Linux x86_64
- Subsystem:
Seems like the version of V8 that node v6 is using has a somewhat nasty for-in bug (that didn't exist in v4). Specifically, for ... in
on proxy objects does not enumerate properties that are on the prototype:
'use strict';
function Obj() {
this.a = 1337;
}
Obj.prototype.func = function () {
return 'w00t';
};
const obj = new Obj();
const obj_props = [];
for (let i in obj) {
obj_props.push(i);
}
const pobj = new Proxy(obj, {});
const pobj_props = [];
for (let i in pobj) {
pobj_props.push(i);
}
console.log(obj_props.sort()); // [ 'a', 'func' ]
console.log(pobj_props.sort()); // [ 'a' ]
This was fixed in V8 here: https://codereview.chromium.org/1516843002
A related problem also fixed in a more V8 version: https://bugs.chromium.org/p/v8/issues/detail?id=5174
There were not really an issue in node v4 because of the old proxy implementation. My apologies if this is something you've already looked into or not the right way to report this.