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

Commit 679cb8a

Browse files
committed
fix($browser/$location): single quote in url causes infinite digest in FF
The real issue is in FF, see https://bugzilla.mozilla.org/show_bug.cgi?id=407172. FF overly encodes stuff which breaks our expectations and then we fail .url() != currentUrl.absUrl() comparison unexpectidly, which leads to infinite digest. The workaround is to correct for this inconsistency in $browser and decode any single quotes in urls. Closes #920
1 parent 4e65635 commit 679cb8a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/ng/browser.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ function Browser(window, document, $log, $sniffer) {
165165
return self;
166166
// getter
167167
} else {
168-
return location.href;
168+
// the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172
169+
return location.href.replace(/%27/g,"'");
169170
}
170171
};
171172

test/ng/browserSpecs.js

+6
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,12 @@ describe('browser', function() {
462462
it('should return $browser to allow chaining', function() {
463463
expect(browser.url('http://any.com')).toBe(browser);
464464
});
465+
466+
467+
it('should decode single quotes to work around FF bug 407273', function() {
468+
fakeWindow.location.href = "http://ff-bug/?single%27quote";
469+
expect(browser.url()).toBe("http://ff-bug/?single'quote");
470+
});
465471
});
466472

467473
describe('urlChange', function() {

0 commit comments

Comments
 (0)