Comment #2 on issue 705 by [email protected]: Non-enumerable property fails to shadow inherited enumerable property from for-in
http://code.google.com/p/v8/issues/detail?id=705

The bug is related to the way we find objects to add in the for-in-loop. The actual value of enumerable (on derived['x]) is actually set to false, this can be confirmed
by doing:

  var base = {x:10};
  var derived = Object.create(base,  {x: {value: 9, enumerable: false}});
  var desc = Object.getOwnPropertyDescriptor(derived, "x");
  for(var v in desc)
    print(v + ": " + desc[v]);

which gives:
  value: 9
  writable: false
  enumerable: false
  configurable: false

In for-in-loop code that finds the elements to add we currently simply discard a value if it is not enumerable. Because we do a bottom up search for properties to add (starting at the actual object and traversing up the prototype chain) we will add the property to the result when processing the prototype of derived(base) even though we
did not add it when processing derived.

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to