es5-shim icon indicating copy to clipboard operation
es5-shim copied to clipboard

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

Open stringbeans opened this issue 8 years ago • 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

stringbeans avatar Apr 19 '16 02:04 stringbeans

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

ljharb avatar Apr 19 '16 02:04 ljharb

removing es5-shim stops it from freezing @ljharb

MikaAK avatar Apr 19 '16 04:04 MikaAK

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

ljharb avatar Apr 19 '16 05:04 ljharb

@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

stringbeans avatar Apr 19 '16 05:04 stringbeans

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

stringbeans avatar Apr 19 '16 05:04 stringbeans

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 avatar Apr 19 '16 06:04 ljharb

@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..

stringbeans avatar Apr 19 '16 06:04 stringbeans

@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 avatar Apr 19 '16 17:04 stringbeans

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

ljharb avatar Apr 19 '16 17:04 ljharb

@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!

stringbeans avatar Apr 19 '16 17:04 stringbeans

https://github.com/angular/angular.js/commit/9c49eb131a6100d58c965d01fb08bcd319032229 may thus be the commit in question

ljharb avatar Apr 19 '16 17:04 ljharb

I see lots of potential in there for infinite loops.

ljharb avatar Apr 19 '16 17:04 ljharb

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

Narretz avatar Apr 21 '16 19:04 Narretz

@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.

ljharb avatar Apr 21 '16 19:04 ljharb