Problems with Object.value/Object.entries when using defineProperty.
Reported by
gordoncl...@gmail.com,
Apr 24 2018
|
||||||||||||||||||||||||
Issue description
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36
Steps to reproduce the problem:
Run the following code in the console:
// Breaks with Object.defineProperty + Object.keys
const object1 = {};
Object.defineProperty(object1, 'test', { value: undefined });
object1.a = object1.b = object1.c = 'value';
console.log('keys', Object.keys(object1));
console.log('values', Object.values(object1));
console.log('\n');
// Works without Object.defineProperty
const object2 = {};
object2.a = object2.b = object2.c = 'value';
console.log('keys', Object.keys(object2));
console.log('values', Object.values(object2));
console.log('\n');
// Works without Object.keys
const object3 = {};
Object.defineProperty(object1, 'test', { value: undefined });
object3.a = object3.b = object3.c = 'value';
console.log('values', Object.values(object3));
console.log('\n');
What is the expected behavior?
console.log('values', Object.values(object1)) should print "value" three times.
What went wrong?
This is causing problems for modules that are being built in webpack. Which have a "_esModule" flag added to all "export" objects.
Did this work before? Yes 65
Chrome version: 66.0.3359.117 Channel: stable
OS Version: OS X 10.13.4
Flash Version:
There seems to be another ticket that hints at a regression, but it is listed for version 65: https://bugs.chromium.org/p/chromium/issues/detail?id=801557&q=Object.entries&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified
The problem I'm having is in version 66.
,
Apr 24 2018
Here are some more test cases:
```
(() => {
console.log('Works with Object.defineProperty');
const object = {};
Object.defineProperty(object, 'test', { value: undefined });
object.a = object.b = object.c = 'value';
console.log('values', Object.values(object).length);
console.log('\n');
})();
(() => {
console.log('Works with Object.keys');
const object = {};
object.a = object.b = object.c = 'value';
Object.keys(object);
console.log('values', Object.values(object).length);
console.log('\n');
})();
(() => {
console.log('Breaks with Object.keys + Object.defineProperty');
const object = {};
Object.defineProperty(object, 'test', { value: undefined });
object.a = object.b = object.c = 'value';
Object.keys(object);
console.log('values', Object.values(object).length);
console.log('\n');
})();
(() => {
console.log('Works with Object.keys + Object.defineProperty after assignments');
const object = {};
object.a = object.b = object.c = 'value';
Object.defineProperty(object, 'test', { value: undefined });
Object.keys(object);
console.log('values', Object.values(object).length);
console.log('\n');
})();
(() => {
console.log('Adding properties "fixes" it until iterating over object');
const testCase = () => {
const object = {};
Object.defineProperty(object, 'test', { value: undefined });
object.a = object.b = object.c = 'value';
Object.keys(object);
console.log('values', Object.values(object).length);
object.d = 'value';
console.log('it works again after adding property', Object.values(object).length);
Object.keys(object);
console.log('it breaks again after Object.keys', Object.values(object).length);
console.log('\n');
};
testCase();
console.log('But running the same code again causes different behavior');
testCase();
})();
```
I've attached a screenshot of the output I get after running the above code in my console in Chrome 66.
,
Apr 24 2018
Happens on windows as well
,
Apr 24 2018
,
Apr 24 2018
Object.entries is affected as well
,
Apr 24 2018
Jakob, ptal
,
Apr 24 2018
,
Apr 24 2018
,
Apr 24 2018
,
Apr 25 2018
Looks very similar to https://crbug.com/804159 , which caused the original revert/reland. cbruni@ kindly volunteered to look at this, thanks!
,
Apr 25 2018
Able to reproduce the issue on Windows 10, mac 10.13.3 and Ubuntu 17.10 using chrome reported version #66.0.3359.117 and latest canary #68.0.3406.0. Bisect Information: ===================== Good build: 66.0.3343.0 Bad Build : 66.0.3344.0 Change Log URL: https://chromium.googlesource.com/chromium/src/+log/6f7666822a7ab47ecd86f732a4a62063298d3514..a36bfd61bb03bc4a29510e628146963e85f74d9d v8-autoroll CL: https://chromium.googlesource.com/v8/v8/+log/919e79fd..d61daa4a From the above change log suspecting below change Change-Id: I57e8b66e1c4ece2abb52e1630a97fbfd4070d810 Reviewed-on: https://chromium-review.googlesource.com/860679 yangguo@ - Could you please check whether this is caused with respect to author (Taketoshi Aono@) change, if not please help us in assigning it to the right owner. Note: ccing the reviewer of the issue as the author (Taketoshi Aono@) doesn't seem to have a chromium id. Thanks...!!
,
Apr 25 2018
,
Apr 25 2018
,
Apr 25 2018
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/76cab5ff786bea157a6931296924384a2242da93 commit 76cab5ff786bea157a6931296924384a2242da93 Author: Camillo Bruni <cbruni@chromium.org> Date: Wed Apr 25 13:44:32 2018 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} [modify] https://crrev.com/76cab5ff786bea157a6931296924384a2242da93/src/builtins/builtins-object-gen.cc [modify] https://crrev.com/76cab5ff786bea157a6931296924384a2242da93/test/mjsunit/es8/object-entries.js
,
Apr 25 2018
,
Apr 25 2018
,
Apr 25 2018
This bug requires manual review: Request affecting a post-stable build Please contact the milestone owner if you have questions. Owners: cmasso@(Android), cmasso@(iOS), josafat@(ChromeOS), abdulsyed@(Desktop) For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Apr 25 2018
Rejecting merge for M66. This just landed today in Canary without any coverage. Why is this critical for M66?
,
Apr 25 2018
It's important because it's breaking the internet: https://bugs.chromium.org/p/v8/issues/detail?id=7687 https://github.com/nodejs/node/issues/20278
,
Apr 25 2018
Yep, today we had to make an emergency release just to polyfill this issue.
,
Apr 25 2018
,
Apr 25 2018
nodejs would be unaffected by this beackmerge and needs to be resolved separately.
,
Apr 25 2018
This bug requires manual review: Request affecting a post-stable build Please contact the milestone owner if you have questions. Owners: cmasso@(Android), cmasso@(iOS), josafat@(ChromeOS), abdulsyed@(Desktop) For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Apr 25 2018
,
Apr 25 2018
,
Apr 26 2018
Your change meets the bar and is auto-approved for M67. Please go ahead and merge the CL to branch 3396 manually. Please contact milestone owner if you have questions. Owners: cmasso@(Android), cmasso@(iOS), kbleicher@(ChromeOS), govind@(Desktop) For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Apr 26 2018
Pls merge your change to M67 branch 3396 ASAP so we can pick it up for next M67 Dev/Beta release. Thank you.
,
Apr 26 2018
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/02854fbce63c23c8adbbbe0422492da12a521d9d commit 02854fbce63c23c8adbbbe0422492da12a521d9d Author: Camillo Bruni <cbruni@chromium.org> Date: Thu Apr 26 17:14:39 2018 Merged: Fix Object.entries/.values with non-enumerable properties Revision: 76cab5ff786bea157a6931296924384a2242da93 BUG= chromium:836145 LOG=N NOTRY=true NOPRESUBMIT=true NOTREECHECKS=true R=ishell@chromium.org Change-Id: Ie8d030e7d4eb945da501a989bd8645582c644f06 Reviewed-on: https://chromium-review.googlesource.com/1030556 Reviewed-by: Igor Sheludko <ishell@chromium.org> Cr-Commit-Position: refs/branch-heads/6.7@{#37} Cr-Branched-From: 8457e810efd34381448d51d93f50079cf1f6a812-refs/heads/6.7.288@{#2} Cr-Branched-From: e921be5c4f2c6407936bde750992dedbf47c1016-refs/heads/master@{#52547} [modify] https://crrev.com/02854fbce63c23c8adbbbe0422492da12a521d9d/src/builtins/builtins-object-gen.cc [modify] https://crrev.com/02854fbce63c23c8adbbbe0422492da12a521d9d/test/mjsunit/es8/object-entries.js
,
Apr 26 2018
,
Apr 26 2018
It also very welcome to see landed on M66.
,
Apr 27 2018
> This just landed today in Canary without any coverage. There is a test in the patch included. Or what type of coverage is needed? > Why is this critical for M66? This bug can clearly cause all kinds of problems depending on how these functions are used. Any application run with M66 is facing the risk of not running properly even though some test cases might have passed and it seemed to work at first. I am just confused that the backport was denied and I am not sure I can follow the reasoning. Is there any downside to backporting this patch?
,
Apr 30 2018
,
May 2 2018
Any updates on this critical bug? And when fix will land on M66?
,
May 2 2018
*** Bulk Edit *** M67 Stable promotion is coming soon. Your bug is labelled as Stable ReleaseBlock, pls make sure to land the fix and request a merge into the release branch ASAP. If fix is already merged to M67 and nothing else is pending, pls mark the bug as fixed. Thank you.
,
May 2 2018
Approving merge to M66. Branch:3359. We don't have a respin planned yet, but will be included if there is a respin.
,
May 3 2018
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/90220c561d0dbc00e17e4a658302960589c8e103 commit 90220c561d0dbc00e17e4a658302960589c8e103 Author: Camillo Bruni <cbruni@chromium.org> Date: Thu May 03 12:31:23 2018 Merged: Fix Object.entries/.values with non-enumerable properties Revision: 76cab5ff786bea157a6931296924384a2242da93 BUG= chromium:836145 LOG=N NOTRY=true NOPRESUBMIT=true NOTREECHECKS=true R=ishell@chromium.org Change-Id: I6888f7aff9f35636cacfe015f128db3019836029 Reviewed-on: https://chromium-review.googlesource.com/1041985 Reviewed-by: Igor Sheludko <ishell@chromium.org> Cr-Commit-Position: refs/branch-heads/6.6@{#55} Cr-Branched-From: d500271571b92cb18dcd7b15885b51e8f437d640-refs/heads/6.6.346@{#1} Cr-Branched-From: 265ef0b635f8761df7c89eb4e8ec9c1a6ebee184-refs/heads/master@{#51624} [modify] https://crrev.com/90220c561d0dbc00e17e4a658302960589c8e103/src/builtins/builtins-object-gen.cc [modify] https://crrev.com/90220c561d0dbc00e17e4a658302960589c8e103/test/mjsunit/es8/object-entries.js
,
May 3 2018
,
Jun 14 2018
Not needed for active Node.js release lines.
,
Jul 3
Able to reproduce the issue on Mac 10.13.3 using chrome build without fix. Verified the fix on Mac 10.13.3, Win-10 and Ubuntu 17.10 using Chrome beta version #68.0.3440.42 as per the comment #1. Attaching screen shot for reference. Observed that upon opening the test.html, got GOOD in good builds. Hence, the fix is working as expected. Adding the verified labels. Thanks...!! |
||||||||||||||||||||||||
►
Sign in to add a comment |
||||||||||||||||||||||||
Comment 1 by woxxom@gmail.com
, Apr 24 2018438 bytes
438 bytes View Download