Bug 38970 - Non-enumerable property fails to shadow inherited enumerable property from for-in
Summary: Non-enumerable property fails to shadow inherited enumerable property from fo...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Major
Assignee: Nobody
URL: https://mail.mozilla.org/pipermail/es...
Depends on:
Reported: 2010-05-11 22:20 PDT by Mark S. Miller
Modified: 2015-10-28 02:07 PDT (History)
10 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Mark S. Miller 2010-05-11 22:20:40 PDT
At https://mail.mozilla.org/pipermail/es5-discuss/2010-May/003536.html Allen clarifies that, according to the ES5 spec,

    function showProps(obj) {
      var result = [];
      for (var k in obj) {
        result.push(k, ': ', ''+obj[k], '\n');
      return result.join('');
    var base = {x:8};
    var derived = Object.create(base, {x: {value: 9, enumerable: false}});

Should print the empty string. On WebKit nightly as of this writing, it prints "x: 9". Besides violating the spec, it is also the less useful behavior for the common for-in loop behavior (shown above as "obj[k]") of using the key to index into the object being iterated, in order to get the corresponding value.
Comment 1 Jordan Harband 2015-10-28 02:07:47 PDT
Ping - adding some people to the CC list.

This is also an issue in v8 ( https://code.google.com/p/v8/issues/detail?id=705 ) although Firefox and IE are correct.