Skip to content

v6 version of V8 has bad for-in implementation #8133

Closed
@deian

Description

@deian
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    v8 engineIssues and PRs related to the V8 dependency.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions