-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix($location): fix infinite recursion/digest on URLs with special characters #16611
Conversation
Since this seems at least related to ~#16611~~ #16606 , I've run the tests in this here PR with the fix from #16611. And only https://github.com/angular/angular.js/pull/16611/files#diff-96e97950408af743f7eb96283d0aa11aR1010 still failed. So maybe we can remove some of these comparisons? Since urlResolve involves DOM manipulation, I was already wondering if they might be too expensive when the url changes often. |
You mean related to #16606 (I think you typed the wrong #)? I know the fix from #16606 seemed to solve this issue, but I still think there are 2 separate problems here (and maybe we need more tests to show that). #16611: #16606: in One of those "normalizations" is standardizing |
Yes, I meant #16606 . The point still stands though. When you combine both PRs, you actually only need to compare the normalized urls here + and include the changes from #16606 : https://github.com/angular/angular.js/pull/16611/files#diff-06a39a7c214933c36a5c4b080ef4d56dR1006. I just don't think it's necessary to include more code than we need. |
You mean only invoke |
That's right only the one Invocation I linked to |
Since that's the only one done in a watcher I think that's fine 👍 Can you think of any tests to add that would enforce that? |
What exactly should the tests enforce? That we only need the single urlsEquals? |
If we decide that we should vs should not use |
…aracters Some characters are treated differently by `$location` compared to `$browser` and the native browser. When comparing URLs across these two services this must be taken into account. Fixes angular#16592 Closes angular#16611
…aracters Some characters are treated differently by `$location` compared to `$browser` and the native browser. When comparing URLs across these two services this must be taken into account. Fixes angular#16592 Closes angular#16611
3 tests were failing in IE9-11, Edge and Mobile Safari 10 (but not Mobile Safari 11!). See https://travis-ci.org/angular/angular.js/jobs/401137341 These browsers seem to not escape quotes in Look ok before sqush+merge? |
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.
LGTM
As someone that has a shop based on angularjs, this bug crashes the website as soon as someone searches for something like |
We should have a new release out later this week @sod. Good to see you are keeping up with the latest versions! |
Some characters are treated differently by
$location
compared to$browser
and the native browser. When comparing URLs across these two services this must be taken into account.Fixes #16592
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
fix
What is the current behavior? (You can also link to an open issue here)
$browser
and$location
persist URLs differently, so comparing them sometimes treats them as not-equal when they should be considered equalWhat is the new behavior (if this is a feature change)?
$location
compares a normalized version of the URLsDoes this PR introduce a breaking change?
Please check if the PR fulfills these requirements
Other information:
All the added tests previously failed, some due to
infdig
and others due toRangeError: Maximum call stack size exceeded
.The tests all use the single-quote to trigger the error, but I assume there are similar cases where
$location
andwindow.location.href
have different escaping/encoding.#16606 partially fixed this (which I still don't quite understand), but some of the tests in this PR still failed.