镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

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

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.

Activity

  1. Fishrock123 commented on Aug 17, 2016

    @Fishrock123
    Contributor

    cc @nodejs/v8

  2. matthewloring commented on Aug 17, 2016

    @matthewloring

    I just gave this a run with V8 5.1 and it appears to be fixed. Once #8054 lands the fix should make it into v6.

  3. targos commented on Sep 12, 2016

    @targos
    Member

    The bug is fixed in v6.5.0. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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