-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix($location): prevent infinite $digest from no trailing slash in IE9 #11581
Conversation
fix($location): prevent infinite $digest from no trailing slash in IE9 This fix prevents IE9 from throwing an infinite $digest error when the user accesses the base URL of the site without a trailing slash. Suppose you owned http://www.mysite.com/app and had an Angular app hosted in a subdirectory "app". If an IE9 user accessed http://www.mysite.com/app infinite $digest errors would be thrown on the console, but the app itself would eventually resolve properly and work fine. Now the infinite $digest errors will not be thrown. Closes #11439
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it! |
CLAs look good, thanks! |
I fully expect this to get some comments as to its correctness. I'm just not sure what the consequences of changing reloadLocation in $browser.url() or trimEmptyHash are, which are where the real problems are found. |
The general gist is: In the initial pass through $locationWatch(), the afterLocationChange call will either add the trailing slash or add the "otherwise" route (say, /Home) to the URL after the hash. If the latter case, $locationWatch will fire again with I'm totally open to something that fixes the real problem rather than basically whacking off the infinite recursion. :) I'm pretty sure the reason this is all fine with browsers with the History API is that the sameBase check returns false in one of those iterations and so reloadLocation gets updated properly. |
Blast. Seems this doesn't fully work anyway. It works on the simplified testcase that's linked off #11439, but it doesn't work in my actual fully fledged app (probably because I have more digest cycles fire). So maybe we have to change $browser.url()'s setter to actually set reloadLocation? I'm not sure why it's doing the sameBase check to begin with, so I'm not sure what the consequences are of changing that. |
…sh in IE9" This reverts commit 488f746.
As this one doesn't work, closing pull request. |
fix($location): prevent infinite $digest from no trailing slash in IE9
This fix prevents IE9 from throwing an infinite $digest error when the user accesses the base
URL of the site without a trailing slash. Suppose you owned http://www.mysite.com/app
and had an Angular app hosted in a subdirectory "app". If an IE9 user accessed
http://www.mysite.com/app infinite $digest errors would be thrown on the console, but the app
itself would eventually resolve properly and work fine. Now the infinite $digest errors will
not be thrown.
Closes #11439