>> (function(){ return Math.max.apply(null, arguments) })(1,2,3)
TypeError: second argument is not an array
at native (native)
at anonymous (:1)
at main (native)
Hi Artem (@drsm ),
Please, try this patch for solve the issue.
@drsm BTW,
non-primitive length properties, are not supported yet, as for example in:
> String.prototype.concat.apply('a', {length:{valueOf:function() {return 2}}, 0:'b', 1:'c'})
'abc'
Some internal mechanisms need to be refactored.
@lexborisov
Hi Alexander!
>> String.prototype.concat.apply('', { length: Object(3), 0: 'a', 1: 'b', 2: 'c' })
''
maybe add some generic njs_arraylike_get_length implementation, if this possible?
It will be also needed in #72
also, if we're moving to ES6, this should be fixed too:
>> String.prototype.concat.apply('', { length: -1, 0: 'a', 1: 'b', 2: 'c' })
MemoryError
@xeioex
I didn't see your answer.
so, everything OK then, except ToLength, Array.prototype.slice is also affected, maybe fix this in a separate patch.
@drsm
I committed this patch to the master branch.
With the next patch, we will refactoring the code and add the implementation of toLength function.
Thank you for the report!
Most helpful comment
@lexborisov
Hi Alexander!
maybe add some generic
njs_arraylike_get_lengthimplementation, if this possible?It will be also needed in #72
also, if we're moving to ES6, this should be fixed too: