MultiplyByZer0, writing on Sack Overflow:
It’s definitely a BUG! And it’s a very serious bug.
The bug is due to the optimization of array initializers in which all values are primitive literals.
reverse()method mutates the array, so it should trigger a copy-on-write. But it doesn’t, because the original implementor (Keith Miller of Apple) missed the
reverse()case, even though he had written many testcases.
Safari may be blazing fast and battery efficient, but in order to achieve that, the engineers are having to introduce a level of complexity and shenanigans that allows this sort of bug to creep into the mix. Not groovy.
And no, this bug is not fixed on all of Apple’s latest stable releases. You can still demo this bug in action on Safari on a Mac. [Update January 11: ok, it looks like this bug is fixed with macOS 10.14.2. But the reality is that millions of Mac users aren’t on this version yet (including yours truly). If you run a website that uses
Array.prototype.reverse(), just because you’re on the latest version doesn’t mean that your users are. In this vein, Safari shouldn’t be held hostage to Mac software updates. In other words, you shouldn’t have to restart your computer in order to get the latest version of Safari. Browser updates should be fast and seamless and independent of OS version, similar to how Google Chrome and FireFox operate. That way, when Apple makes blunders like this, it can bring the fix to a higher number of users with a faster metabolism.]
It’s this kind of nonsense (as well as Apple’s stubborn position to be the only browser that does not support
pointerdown) that makes frontend developers mock Safari and refuse to take it seriously.