From df2b0015de8ac6979896fe28dc179646a9eebd3b Mon Sep 17 00:00:00 2001 From: Colin MacKenzie Date: Fri, 22 Aug 2014 14:54:00 -0400 Subject: [PATCH 1/2] fix($browser): colin in url causes infinite digest in FF FF encodes colons after string position seven in urls, this causes .url() != currentUrl.absUrl(), which leads to infinite digest. The workaround is to correct this in $browser and decode colons in urls. --- src/ng/browser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ng/browser.js b/src/ng/browser.js index 3ca4a7c0a86c..0ab0828dffa0 100644 --- a/src/ng/browser.js +++ b/src/ng/browser.js @@ -122,7 +122,7 @@ function Browser(window, document, $log, $sniffer) { // URL API ////////////////////////////////////////////////////////////// - var lastBrowserUrl = location.href, + var lastBrowserUrl = location.href.replace(/%3A/g, ":"), baseElement = document.find('base'), newLocation = null; @@ -175,7 +175,7 @@ function Browser(window, document, $log, $sniffer) { // - newLocation is a workaround for an IE7-9 issue with location.replace and location.href // methods not updating location.href synchronously. // - the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172 - return newLocation || location.href.replace(/%27/g,"'"); + return newLocation || location.href.replace(/%27/g,"'").replace(/%3A/g, ":"); } }; From c9cd567d44c05d3e6326a8ba68be728f1f2ad8e4 Mon Sep 17 00:00:00 2001 From: Colin MacKenzie Date: Fri, 22 Aug 2014 16:13:45 -0400 Subject: [PATCH 2/2] added test to check for colon decoding --- test/ng/browserSpecs.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/ng/browserSpecs.js b/test/ng/browserSpecs.js index fc50795b4ec5..ea4dd8f657f2 100755 --- a/test/ng/browserSpecs.js +++ b/test/ng/browserSpecs.js @@ -466,6 +466,11 @@ describe('browser', function() { expect(browser.url()).toBe("http://ff-bug/?single'quote"); }); + it('should decode colons to work around FF bug', function() { + fakeWindow.location.href = "http://ff-bug/?https%3Awww.google.com"; + expect(browser.url()).toBe("http://ff-bug/?https:www.google.com"); + }); + it('should not set URL when the URL is already set', function() { var current = fakeWindow.location.href; sniffer.history = false;