Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix(browser): prevent ie from getting into redirect loop
Browse files Browse the repository at this point in the history
Closes #1075
Closes #1079
Closes #1085
  • Loading branch information
mhevery committed Jun 22, 2012
1 parent 0d57f13 commit ffb2701
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ng/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ function Browser(window, document, $log, $sniffer) {
self.url = function(url, replace) {
// setter
if (url) {
if (lastBrowserUrl == url) return;
lastBrowserUrl = url;
if ($sniffer.history) {
if (replace) history.replaceState(null, '', url);
Expand Down
8 changes: 8 additions & 0 deletions test/ng/browserSpecs.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,14 @@ describe('browser', function() {
fakeWindow.location.href = "http://ff-bug/?single%27quote";
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() {
Expand Down

0 comments on commit ffb2701

Please sign in to comment.