Issue metadata
Sign in to add a comment
|
Issue with array built-in reduceRight when using arguments
Reported by
peter.f....@gmail.com,
Aug 15 2017
|
||||||||||||||||||||||||
Issue description
UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36
Steps to reproduce the problem:
In snippets run this code:
/* This works in 59 and 61
* Enabling the line with:
* // funcList = funcList.splice(0);
* works around the issue
*
*/
function increment(value) {
return value + 1;
};
function double(value) {
return value * 2;
}
function compose() {
let funcList = [];
Array.prototype.push.apply(funcList, arguments);
// Enable this line in chrome 60 to correct the issue
// funcList = funcList.splice(0);
let firstFn = funcList.pop();
return function() {
return funcList.reduceRight((nextArgs, func, index) => {
return func.call(null, nextArgs);
}, firstFn.apply(null, arguments));
};
}
compose(double, increment);
What is the expected behavior?
reduceRight should not return undefined when an element exists at a given index
What went wrong?
It looks like reduceRight is not returning the correct value.
This seems to be tied to "arguments" not getting put into an array correctly using Array.prototype.push.apply
Did this work before? Yes 59.0.3071.86
Chrome version: 60.0.3112.101 Channel: stable
OS Version: 10
Flash Version:
Works in canary
,
Aug 15 2017
Interesting that this is only happening in 60. Adamk@ any clue whats going on?
,
Aug 15 2017
Bisecting shows that this was fixed in f030838700a83cde6992cb8ebcb3facc6a8fc1f1, so marking as a dup of the bug that fixed. The 6.0 timeline also fits that theory. |
|||||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||||
Comment 1 by bokan@chromium.org
, Aug 15 2017