es-shims/es5-shim

es5-shim + angular 1.5 + currency filter crashes safari 8.x

stringbeans opened this issue ยท 14 comments

When using the built-in currency filter in Angular 1.5.x , with es5-shim 4.5.8 and browsing with Safari 8.x the browser will crash...

http://plnkr.co/edit/zshIf4lDR0YgUXmHl8ou?p=preview

Hmm - I see the browser tab freezing. Does this happen without the es5-shim?

removing es5-shim stops it from freezing @ljharb

@MikaAK does removing the currency filter usage also stop it from freezing?

@ljharb removing the currency filter stops the freezing as well. This bug occurs if and only if both es5-shim and the currency filter are being used. I've also tried with other angular filters and it seems like it only occurs with the currency one

Just to note, I've also tried downgrading to 4.2.x and the error still persists. Have not tried lower versions

Interesting, OK - this is going to be super hard to figure out because it doesn't error, it freezes.

A few things have happened with angular in the past that I'm pretty sure the currency filter is doing something super weird, and angular isn't interacting well with the es5-shim.

Knowing which version of angular started causing the problem would be very helpful, however.

@ljharb I have a gut feeling this began occurring when we upgraded to angular 1.5.x. I'll do some tests with 1.4.x tomorrow to see if I can track down when it started happening..

@ljharb ive found that it occurs in angular 1.4.9 but NOT 1.4.8... so 1.4.9 introduced the breaking change

@stringbeans Thanks, that's super helpful! Looking at angular/angular.js@v1.4.8...v1.4.9 isn't helping much, sadly :-/

@ljharb i logged it in the angular repo too so hopefully a maintainer there will have an idea. i also looked at their changelog (https://github.com/angular/angular.js/blob/master/CHANGELOG.md) and for the 1.4.9 release there were changes made to formatNumber which may be the culprit!

angular/angular.js@9c49eb1 may thus be the commit in question

I see lots of potential in there for infinite loops.

Is there actually anything in Safari 8 that needs to be shimmed?

@Narretz There is something in every single version of every single browser/engine that needs to be shimmed: there does not exist a JS engine that fully complies with ES5, even to this day.