mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-17 03:01:06 +00:00
fix(browser): prevent ie from getting into redirect loop
Closes #1075 Closes #1079 Closes #1085
This commit is contained in:
parent
0d57f1373f
commit
ffb270130a
2 changed files with 9 additions and 0 deletions
|
|
@ -149,6 +149,7 @@ function Browser(window, document, $log, $sniffer) {
|
||||||
self.url = function(url, replace) {
|
self.url = function(url, replace) {
|
||||||
// setter
|
// setter
|
||||||
if (url) {
|
if (url) {
|
||||||
|
if (lastBrowserUrl == url) return;
|
||||||
lastBrowserUrl = url;
|
lastBrowserUrl = url;
|
||||||
if ($sniffer.history) {
|
if ($sniffer.history) {
|
||||||
if (replace) history.replaceState(null, '', url);
|
if (replace) history.replaceState(null, '', url);
|
||||||
|
|
|
||||||
|
|
@ -468,6 +468,14 @@ describe('browser', function() {
|
||||||
fakeWindow.location.href = "http://ff-bug/?single%27quote";
|
fakeWindow.location.href = "http://ff-bug/?single%27quote";
|
||||||
expect(browser.url()).toBe("http://ff-bug/?single'quote");
|
expect(browser.url()).toBe("http://ff-bug/?single'quote");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not set URL when the URL is already set', function() {
|
||||||
|
var current = fakeWindow.location.href;
|
||||||
|
sniffer.history = false;
|
||||||
|
fakeWindow.location.href = 'dontchange';
|
||||||
|
browser.url(current);
|
||||||
|
expect(fakeWindow.location.href).toBe('dontchange');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('urlChange', function() {
|
describe('urlChange', function() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue