-
Notifications
You must be signed in to change notification settings - Fork 27.5k
angular 1.5 + es5-shim + currency filter crashes safari 8.x #14467
Comments
after debugging ive found that it occurs in angular 1.4.9 but NOT 1.4.8... so 1.4.9 introduced the breaking change |
v1.4.8...v1.4.9 is pretty big. It would be awesome to get a bisect and figure out which commit broke it :-) |
Lots of potential in 9c49eb1 for infinite loops and relying on non-standard slice/indexOf/replace behavior (no specific clues tho) |
Does it happen on all 1.5.x versions ? (I.e. from 1.5.0-beta.1 onwards ?) |
@gkalpak I've found that it occurs on all versions starting from 1.4.9 to 1.5.5. I have not tried the beta versions of 1.5 |
So, what does "all versions" mean ? All stable versions ? |
@gkalpak sorry, let me clarify. I have verified that this issue occurs in Angular 1.4.9, 1.4.10, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4, and 1.5.5. All stable versions (no release candidates or beta releases). In Angular 1.4.8 the behaviour is as expected, so the transition from 1.4.8 to 1.4.9 is what caused the breaking change. |
+1, this is happening for me too 1.5.3 of Angular |
@ljharb can you clarify why do you think infinite loops might be possible in this commit? |
once I removed the currency filter the site worked again as intended, if that helps |
@Narretz any time you're using a while loop, it's a possibility - loops should be avoided. specifically, your while loops rely on how |
@ljharb if ES5 is shimmed on all browsers, then why does it only fail on Safari 8? |
I don't know yet :-) but different things are shimmed on different browsers, and sometimes browsers have weird bugs when built in methods are replaced. |
It is probably because Safari 8 fails some test ( |
The issue is indeed an infinite loop caused by "unexpected" behavior of the (shimmed) Angular (and MDN) expects that if The es5-shimmed version, treats an omitted (undefined) I'm not sure what the spec says about it. Needs further investigation (but it would be very surprising if es5-shim is "right" here). |
So, to my great surprise ( 😛 ), in ES5 omitting the 2nd argument shouldn't do anything (so es5-shim is doing the right™ thing). One could argue that the spec isn't 100% clear on what should happen when In ES6 the behavior is clearly specified and it is as described on MDN. 😒 So, it seems like we need to fix that 😃 |
The However yes, relying on behavior that changed between ES5 and ES6 should be avoided :-) |
When calling `.splice()` without a 2nd argument (`deleteCount`), most browsers will splice to the end of the array. As it turns out, this is the behavior specified in [ES2015][es6]. In [ES5][es5], the spec seems to imply that nothing should happen. To avoid inconsistent behavior among browsers implementing different versions of the EcmaScript standart or when ES5 shims are included (e.g. https://github.com/es-shims/es5-shim/), this commit ensures that all calls to `.splice()` provide at least two arguments. [es5]: http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.12 [es6]: http://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.splice Fixes angular#14467
When calling `.splice()` without a 2nd argument (`deleteCount`), most browsers will splice to the end of the array. As it turns out, this is the behavior specified in [ES2015][es6]. In [ES5][es5], the spec seems to imply that nothing should happen. To avoid inconsistent behavior among browsers implementing different versions of the EcmaScript standart or when ES5 shims are included (e.g. https://github.com/es-shims/es5-shim/), this commit ensures that all calls to `.splice()` provide at least two arguments. [es5]: http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.12 [es6]: http://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.splice Fixes #14467 Closes #14489
When calling `.splice()` without a 2nd argument (`deleteCount`), most browsers will splice to the end of the array. As it turns out, this is the behavior specified in [ES2015][es6]. In [ES5][es5], the spec seems to imply that nothing should happen. To avoid inconsistent behavior among browsers implementing different versions of the EcmaScript standart or when ES5 shims are included (e.g. https://github.com/es-shims/es5-shim/), this commit ensures that all calls to `.splice()` provide at least two arguments. [es5]: http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.12 [es6]: http://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.splice Fixes #14467 Closes #14489
The fix is in. It will be included in the next 1.4.x/1.5.x releases. |
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
(also logged with es5-shim... es-shims/es5-shim#398)
The text was updated successfully, but these errors were encountered: