es-shims / es5-shim

ECMAScript 5 compatibility shims for legacy (and modern) JavaScript engines
MIT License
7.12k stars 900 forks source link

Safari 10.1 array modifying methods bug? #449

Open Xotic750 opened 6 years ago

Xotic750 commented 6 years ago

https://bugs.webkit.org/show_bug.cgi?id=170264

Can be detected and fixed I believe? Quite large numbers of people affected that are using libraries such as big.js, bignumber.js and decimal.js. https://github.com/MikeMcl/bignumber.js/issues/120

Anyway, just a heads up.

ljharb commented 6 years ago

Here's the test webkit uses: https://bugs.webkit.org/attachment.cgi?id=306201&action=diff#JSTests/stress/double-array-to-array-storage.js_sec1

I'm not sure if it can be fixed, since it was a bug in the C++ JSObject inside webkit. I'll leave this open just in case tho.

Xotic750 commented 6 years ago

I'm not sure how much it affects all array things on the whole, I do know that it can be detected and certain work-arounds for specific use cases can be implemented, but I don't know if a general fix for methods can be applied.

Xotic750 commented 6 years ago

I had a look to see what could be done about this, whether there was a global fix that could done. I didn't find a way, but it did come up with this

https://github.com/Xotic750/create-array-fix-x

But can't test it because I have no access to Safari :( Thought I'd just post the info in case it comes in useful. :)

https://rawgit.com/Xotic750/create-array-fix-x/master/tests/index.html

It's by no means fully working (methods that return arrays are not correct), but it does show what could be possible, with a little more work.