Skip to content

Commit 59f1d2b

Browse files
committed
fix($browser): prevent infinite $digest from no trailing slash in IE9
fix($browser): 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 angular#11439
1 parent 77f352e commit 59f1d2b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/ng/browser.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ function Browser(window, document, $log, $sniffer) {
135135
cacheState();
136136
lastHistoryState = cachedState;
137137

138+
self.forceReloadLocationUpdate = function(url) {
139+
if (reloadLocation) {
140+
reloadLocation = url;
141+
}
142+
};
143+
138144
/**
139145
* @name $browser#url
140146
*
@@ -190,7 +196,9 @@ function Browser(window, document, $log, $sniffer) {
190196
// Do the assignment again so that those two variables are referentially identical.
191197
lastHistoryState = cachedState;
192198
} else {
193-
reloadLocation = url;
199+
if (!sameBase) {
200+
reloadLocation = url;
201+
}
194202
if (replace) {
195203
location.replace(url);
196204
} else if (!sameBase) {

src/ng/location.js

+3
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,9 @@ function $LocationProvider() {
944944
oldState === $location.$$state ? null : $location.$$state);
945945
}
946946
afterLocationChange(oldUrl, oldState);
947+
if ($location.$$html5 && $location.absUrl().indexOf("#") > -1 && $location.absUrl() !== $browser.url()) {
948+
$browser.forceReloadLocationUpdate($location.absUrl());
949+
}
947950
}
948951
});
949952
}

0 commit comments

Comments
 (0)