-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Inject $location service cause $rootScope:infdig error on Edge 14.14393 (latest) and Angular 1.5.8 when html5mode is on and the page has an Internationalized Domain Name domain #15217
Comments
Hi,
It looks like at this point, $location.absUrl() is undefined. In 1.5.6, the relevant change seems to come from 743b33a. Then in 1.5.7, we added this: 294d679 and this Can you please also report this bug with Microsoft? This could also be a bug on their end. |
So this is definitely an EdgeBug. We Use string.lastIndexOf(string, 0) as a startsWith alternative. In Edge, when the string contains an Umlaut, this returns -1, but it should return 0. See http://plnkr.co/edit/p8jN3rVsMl6eid17XN7T?p=preview. I am not sure why we don't use indexOf for this. Would be a pretty simple change. |
I assume |
Internationalized Domain Urls, for example Urls with Umlaut (Ä, Ö, Ü) cause infinite digest in Edge 38.14393.0.0 because lastIndexOf doesn't work correctly in this version. indexOf does, though. Fixes angular#15217
That makes sense. We could also use the native startsWith fn if it is available, otherwise fall back to lastIndexOf |
Using the native one might be worth it. Depends where this method is used and the likelihood of having long strings. If it's only used on URLs, and not in the digest, then just doing |
It's only used on urls, but it's part of the locationWatchFn, but only if the url changed and inside an evalAsync |
IIRC, we were using |
Great to see that a workaround from the code side is implementable. I will report the bug in Edge as well. |
Here's the edge bug: https://t.co/vxbg2b4ORJ has been auto created from a tweet :D Ideally, everybody should report or +1 this issue as well, so that it might get some traction. |
Internationalized Domain Urls, for example urls with Umlaut (Ä, Ö, Ü) cause infinite digest in Edge 38.14393.0.0 because lastIndexOf doesn't work correctly in this version when the search string is the same as the haystack string. The patch uses an implementation based on core.js: https://github.com/zloirock/core-js/blob/v2.4.1/modules/es6.string.starts-with.js#L16 Edge Bug: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9271625/ Fixes #15217 PR #15235
Internationalized Domain Urls, for example urls with Umlaut (Ä, Ö, Ü) cause infinite digest in Edge 38.14393.0.0 because lastIndexOf doesn't work correctly in this version when the search string is the same as the haystack string. The patch uses an implementation based on core.js: https://github.com/zloirock/core-js/blob/v2.4.1/modules/es6.string.starts-with.js#L16 Edge Bug: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9271625/ Fixes #15217 PR #15235
Internationalized Domain Urls, for example urls with Umlaut (Ä, Ö, Ü) cause infinite digest in Edge 38.14393.0.0 because lastIndexOf doesn't work correctly in this version when the search string is the same as the haystack string. The patch uses an implementation based on core.js: https://github.com/zloirock/core-js/blob/v2.4.1/modules/es6.string.starts-with.js#L16 Edge Bug: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9271625/ Fixes angular#15217 PR angular#15235
Internationalized Domain Urls, for example urls with Umlaut (Ä, Ö, Ü) cause infinite digest in Edge 38.14393.0.0 because lastIndexOf doesn't work correctly in this version when the search string is the same as the haystack string. The patch uses an implementation based on core.js: https://github.com/zloirock/core-js/blob/v2.4.1/modules/es6.string.starts-with.js#L16 Edge Bug: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9271625/ Fixes angular#15217 PR angular#15235
Internationalized Domain Urls, for example urls with Umlaut (Ä, Ö, Ü) cause infinite digest in Edge 38.14393.0.0 because lastIndexOf doesn't work correctly in this version when the search string is the same as the haystack string. The patch uses an implementation based on core.js: https://github.com/zloirock/core-js/blob/v2.4.1/modules/es6.string.starts-with.js#L16 Edge Bug: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9271625/ Fixes angular#15217 PR angular#15235
Internationalized Domain Urls, for example urls with Umlaut (Ä, Ö, Ü) cause infinite digest in Edge 38.14393.0.0 because lastIndexOf doesn't work correctly in this version when the search string is the same as the haystack string. The patch uses an implementation based on core.js: https://github.com/zloirock/core-js/blob/v2.4.1/modules/es6.string.starts-with.js#L16 Edge Bug: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9271625/ Fixes angular#15217 PR angular#15235
Internationalized Domain Urls, for example urls with Umlaut (Ä, Ö, Ü) cause infinite digest in Edge 38.14393.0.0 because lastIndexOf doesn't work correctly in this version when the search string is the same as the haystack string. The patch uses an implementation based on core.js: https://github.com/zloirock/core-js/blob/v2.4.1/modules/es6.string.starts-with.js#L16 Edge Bug: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9271625/ Fixes angular#15217 PR angular#15235
Internationalized Domain Urls, for example urls with Umlaut (Ä, Ö, Ü) cause infinite digest in Edge 38.14393.0.0 because lastIndexOf doesn't work correctly in this version when the search string is the same as the haystack string. The patch uses an implementation based on core.js: https://github.com/zloirock/core-js/blob/v2.4.1/modules/es6.string.starts-with.js#L16 Edge Bug: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9271625/ Fixes #15217 PR #15235
Internationalized Domain Urls, for example urls with Umlaut (Ä, Ö, Ü) cause infinite digest in Edge 38.14393.0.0 because lastIndexOf doesn't work correctly in this version when the search string is the same as the haystack string. The patch uses an implementation based on core.js: https://github.com/zloirock/core-js/blob/v2.4.1/modules/es6.string.starts-with.js#L16 Edge Bug: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9271625/ Fixes #15217 PR #15235
Internationalized Domain Urls, for example urls with Umlaut (Ä, Ö, Ü) cause infinite digest in Edge 38.14393.0.0 because lastIndexOf doesn't work correctly in this version when the search string is the same as the haystack string. The patch uses an implementation based on core.js: https://github.com/zloirock/core-js/blob/v2.4.1/modules/es6.string.starts-with.js#L16 Edge Bug: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9271625/ Fixes angular#15217 PR angular#15235
Hello,
Yes, as the title define it "Inject $location service cause $rootScope:infdig error on Edge 14.14393 (latest) and Angular 1.5.8 when html5mode is on and the page have an IDN domain" quite specific and quite complicate to find the issue too.
Before go to the detail
It happen only with the latest version of Edge (14.14393) and the latest version of Angular (1.5.8), if we use ng 1.5.8 and a previous version of Edge the problem doesn't happen, the same if we use ng 1.5.5 and the latest version of Edge. So, I am not totally sure if the problem could be on Edge or Angular, but for sure would be possible to have a workaround to avoid it.
How to reproduce the error
Run the following code in a IDN domain and browse the page using Edge (14.4393)
http://jsfiddle.net/Lvc0u55v/10528/
Web console output:
If the domain is not an idn domain (doesn't matter if on the cloud or locally) the error doesn't happen.
If the html5mode is not activated, the error doesn't happen.
Posible fix meanwhile
Downgrade Angular to 1.5.5.
If possible doesn't use html5mode.
If possible doesn't use $location service, use window.location instead.
Some links
Edge 14.14393 (latest): https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ (the version of BrowserStack doesn't throw error because is not the latest)
IDN domain: https://en.wikipedia.org/wiki/Internationalized_domain_name
Since usually Edge is updated automatically to the latest version, this could be a serious bug. Have html5mode activated and use $location service could be a common practice.
Thanks,
J.
The text was updated successfully, but these errors were encountered: