-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node 10.0.0 Object.values() returns incorrect array #20278
Comments
@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 |
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... |
Also, adding |
I can definitely reproduce this in Chromium 66.0.3359.117. |
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 Edit: I can reproduce on 67.0.3396.10 |
I can reproduce in V8, and will bisect. |
I can reproduce with V8 canary. Opened https://bugs.chromium.org/p/v8/issues/detail?id=7687 upstream. |
- Replace new Buffer() with Buffer.from() - Work around nodejs/node#20278 - Upgrade to source-map-support@0.5.5
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= |
- Replace new Buffer() with Buffer.from() - Work around nodejs/node#20278 - Upgrade to source-map-support@0.5.5
Original commit message: Fix Object.entries/.values with non-enumerable properties Iterate over all descriptors instead of bailing out early and missing enumerable properties later. Bug: chromium:836145 Change-Id: I104f7ea89480383b6b4b9204942a166bdf8e0597 Reviewed-on: https://chromium-review.googlesource.com/1027832 Reviewed-by: Jakob Gruber <jgruber@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/master@{nodejs#52786} Refs: v8/v8@76cab5f Fixes: nodejs#20278
Original commit message: Fix Object.entries/.values with non-enumerable properties Iterate over all descriptors instead of bailing out early and missing enumerable properties later. Bug: chromium:836145 Change-Id: I104f7ea89480383b6b4b9204942a166bdf8e0597 Reviewed-on: https://chromium-review.googlesource.com/1027832 Reviewed-by: Jakob Gruber <jgruber@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/master@{#52786} Refs: v8/v8@76cab5f Fixes: #20278 PR-URL: #20350 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
To reproduce the problem, create the following js files:
Now
node test
prints:Interestingly,
node test1
prints:Please note
Object.values(x)
intest.js
returns[]
. I expect it to print:I tried Node 8.x, both
test
andtest1
work as expected.The text was updated successfully, but these errors were encountered: