Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES5 Array method wrappers need full implementations #342

Open
ljharb opened this issue May 9, 2015 · 0 comments
Open

ES5 Array method wrappers need full implementations #342

ljharb opened this issue May 9, 2015 · 0 comments

Comments

@ljharb
Copy link
Collaborator

ljharb commented May 9, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant