html5mode on IE9 leads to redirect loop behavior on every digest during initial page load #9235
Description
Edit: Fixed URL in step 1.
This can lead to unresponsive pages as the browser attempts to make N number of requests during page load where N is the number of digests that occur after setting up $location
.
Note that this is also occurring on angularjs.org. It's just less severe because there are few digests that occur after page load. As such, it maybe related to #6820 .
Reproducible: always
Browsers: IE9 (Most probably affects IE7 and IE8 too, but I haven't tested it)
Affects: Regression from AngularJS 1.2.24 and 1.3.0-RC.0
Steps to reproduce:
- Open IE9. Set it up to preserve logs across navigation (Tools -> Clear Entries on Navigate -> Uncheck Console and Network)
Go to the following page:
http://run.plnkr.co/plunks/EHfYEeONdOFa6Xu4owUx/test/index.html - Observe that the logs show
Navigating to <plunker>/#/test/index.html
the same page multiple times.
As seen here, IE is actually making many requests that are aborted (possibly DDoSing some websites, depending on the number of digest cycles):
Expected behavior:
- Navigate to hashbang URL once and wait for it to load.
Source Plunker:
http://plnkr.co/edit/EHfYEeONdOFa6Xu4owUx?p=preview
This is caused by 2ece4d0 (#6976), since fireUrlChange
sets newLocation
to null (on this line) and it doesn't account for the fact that setting href is async on IE9.
As setting location.href
isn't synchronous on IE9, each digest cycle is actually clearing the locationUrl state (that's used to save the navigating state for IE9) so the digest initiates another change to location.href on every digest and the browser actually sends another request instead of continuing to navigate to the same href set previously (in the previous digest cycle).