New issue
Advanced search Search tips

Issue 708971 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Array.reduce() returns NaN or undefined when executed inside a RAF loop

Reported by julian.g...@gmail.com, Apr 6 2017

Issue description

Chrome Version       : 59.0.3063.0
OS Version: OS X 10.12.3
URLs (if applicable) : http://codepen.io/juliangarnier/pen/JWVmpR?editors=0011
Other browsers tested:
  Chrome 57: OK
  Safari 10: OK
  Firefox 52: OK

What steps will reproduce the problem?
1. Create a function that use Array.reduce() to process data from 2 Arrays and return the result. 
2. Loop through the function using requestAnimationFrame an log the result.
3. Wait a few seconds, between 10s and 40s.

What is the expected result?
The result of the function is logged every frame, returning the proper Array.reduce() operation result.

What happens instead of that?
Array.reduce() returns undefined or NaN depending of the type of data contained in the Arrays.

Please provide any additional information below. Attach a screenshot if
possible.
Looks like the problem happens more quickly if looped inside a for loop.

The problem can be solved by replacing the native Array.reduce with a polyfill (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce#Polyfill) 


UserAgentString: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3063.0 Safari/537.36



 
Screen Shot 2017-04-06 at 11.37.23.png
128 KB View Download
Labels: Needs-Triage-M59

Comment 2 by a...@chromium.org, Apr 6 2017

Components: Blink>JavaScript
Labels: -OS-Mac
Not Mac-specific
Cc: kkaluri@chromium.org
Labels: Needs-Feedback
Tested this issue on Windows 10 using chrome #59.0.3064.0 as per steps mentioned in the comment #0

Didn't observe any undefined or NaN depending of the type of data contained in the Arrays
Attaching the screen-shot for reference.

julian.garnier@ Could you re-try the same scenario on clean profile with no apps & extensions and let us know your observations.

Thank You...
Issue 708971.PNG
92.6 KB View Download
Tested on 59.0.3065.0 with the same profile than my first test on 59.0.3063.0 and didn't observe any problem either.

Looks like the problem was related to <= 59.0.3063.0

PS: Not sure if I can mark this issue as resolved, I don't see any button

Thanks
Project Member

Comment 5 by sheriffbot@chromium.org, Apr 7 2017

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "kkaluri@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 6 by ajha@chromium.org, Apr 10 2017

Status: WontFix (was: Unconfirmed)
Thanks  julian.garnier@ for an update. Closing this as per C#4. 

Sign in to add a comment