Repository navigation
Node 10.0.0 Object.values() returns incorrect array #20278
Description
Activity
@AyushG3112 Are you sure? I can definitely reproduce, on multiple platforms.
@apapirovski nevermind, looks like my PC had some version conflicts while installing v10.0.0 from
nvm. Will try fixing those and will try again. (deleting previous comment till then)Ouch...
'use strict'; const obj = {}; Object.defineProperty(obj, 'ibreakyourobjects', { value: true }); obj.X = true; console.log(Object.values(obj)); // [ true ] Object.keys(obj); console.log(Object.values(obj)); // []
ping @nodejs/v8 this looks bad to me...
Reacted by Nikita Skovoroda and Yahor SiarheyenkaAlso, adding
enumerable: trueonibreakyourobjectsfixes the bug... (setting it tofalsebreaks it again)I can definitely reproduce this in Chromium 66.0.3359.117.
Reacted by Steven- addedv8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.
on Apr 25, 2018 Also, swapping order of declarations like so:
'use strict'; const obj = {}; obj.X = true; Object.defineProperty(obj, 'ibreakyourobjects', { value: true }); obj.Y = true; console.log(Object.values(obj)); // [ true, true ] Object.keys(obj); console.log(Object.values(obj)); // [ true ]
Note how the one before the
definePropertyis still there but the one after isn't.Edit: I can reproduce on 67.0.3396.10
I can reproduce in V8, and will bisect.
Reacted by StevenI can reproduce with V8 canary.
Opened https://bugs.chromium.org/p/v8/issues/detail?id=7687 upstream.
Reacted by Yahor Siarheyenka and Mathias Bynens- addedconfirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.
on Apr 25, 2018 - added a commit that references this issue
on Apr 25, 2018 V8 issue with the recent optimizations for speed of Object.values and Object.entries: https://bugs.chromium.org/p/chromium/issues/detail?id=836145&can=2&start=0&num=100&q=&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified&groupby=&sort=
- added a commit that references this issue
on Apr 25, 2018 - added a commit that references this issue
on Apr 27, 2018 - added a commit that references this issue
on May 4, 2018 - added a commit that references this issue
on Jul 27, 2026
To reproduce the problem, create the following js files:
Now
node testprints:Interestingly,
node test1prints:Please note
Object.values(x)intest.jsreturns[]. I expect it to print:I tried Node 8.x, both
testandtest1work as expected.