Skip to content

ES5 Array method wrappers need full implementations #342

@ljharb

Description

@ljharb

Originally part of #341.

var c = 0;
[].map.call({get length(){c++;return 0}}, isNaN);
c; // => 2, should be 1 

var O = {length: Math.pow(2, 32) + 1};
O[Math.pow(2, 32)] = 42;
[].forEach.call(O, console.log, console); // => nothing, should be 42, 4294967296, O

To fix both of these, instead of calling the native methods (in the scenario where the native methods behave incorrectly for negative and over-32-bit-length array-like objects), we need to reimplement all of them in their entirety. The ideal way to do this is to require in the implementations from the es5-shim, rather than duplicating all of the tests and code.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions