-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix($browser): colon in url causes infinite digest in FF #8734
Conversation
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.
missing a test case |
@caitp, added a test |
I can't reproduce this one with FF31: http://plnkr.co/edit/Yh2uKjzcPCGFySC8NddA?p=preview can you please adjust the plunker to show the buggy behavior? thanks! |
I don't think that's a real reproduction because we aren't doing anything to rewrite the URL in that script Igor, I don't see angular being used in either the iframe or the main page there. |
I've modified Igor's plunker to use |
should be noted: the test case fails in other browsers without the fix applied, too |
@@ -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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is also not verifying that you're preventing an infinite digest error, which is what this bug is about. We need to be able to reproduce the infdig condition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tried to mimic the described FF behavior without angular. The test
looks fishy to me. It just test that we rewrite the url without actually
reproducing the browser issue. That would be fine if at least we could
repro the browser issue in isolation but we can't.
On Aug 22, 2014 5:50 PM, "Caitlin Potter" [email protected] wrote:
In 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");
This test is also not verifying that you're preventing an infinite digest
error, which is what this bug is about—
Reply to this email directly or view it on GitHub
https://github.com/angular/angular.js/pull/8734/files#r16627434.
@mackenco can you please provide more info on how to reproduce this issue. Otherwise we'll close this PR. thanks! |
Hey guys - I've tried a handful of different things, but unfortunately haven't been able to get any of the tests to recreate the issue. Looks like it may just be something that was happening in my app's specific environment + FF. Closest I could get was the infdig issue happening when running the phonecat app on localhost in an iframe in FF. A bummer for me, but you can probably go ahead and close the PR. 😢 |
thanks for the update. |
Bug found when an angular app is running in an iframe + has a colon in the query string in Firefox. This stops angular from working until the page is refreshed, errors are:
(fixed with the addition to line 178)
and
(fixed with the addition to line 125).
What is happening is that Firefox's location.href encodes colons (after string position seven) to %3A. This doesn't match with other encoding and the app gets stuck. For example, we were passing in an absolute url through the query and getting issues; it also happened with the port on localhost. Very similar to: #920.
To reproduce, just run a small app locally in Firefox (I was able to recreate with angular phonecat) in an iframe.