-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Ajax: use anchor tag for parsing urls #1880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Lost some comments when force-pushing. I'm not sure if this is because I amended the commit rather than rebasing. |
|
Ow, some thorny issues here. Unit tests fail because they assert that the URL has not been changed other than removing the hash. There are some other failures but I haven't looked into what's causing them. The new behavior of changing the URL from relative to absolute in particular might be a problem. Can you run the unit tests locally and recommend a solution? We might, for example, leave the |
|
I thought I was running CI locally, but apparently not. I'll try again. |
|
I updated this PR to only use the new URL parsing for setting |
|
Also, I got CI running locally, and this fixes the failing tests. |
|
Thanks @mastahyeti, yeah i wish we could clean up the URL but my gut feeling is that it would break a lot of code. @jaubourg could you take a look as well and give your thoughts? The new approach looks a lot cleaner in any case. |
src/ajax.js
Outdated
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 should still be using s.url like the code it replaces.
|
I've addressed all the issues that were brought up in review. Is this good to go? |
|
LGTM 👍 |
|
Just wondering why the anchor is created at each call but that's fine either way. |
|
i noticed that as well but decided it was better to make sure it was "clean" rather than cache it somehow. |
|
LGTM 👍 |
|
@mastahyeti I was about ready to land this but in running through our supported browsers I'm getting fails in every version of IE. Can you take a look? |
|
What is an IE? I just downloaded an IE 11 VM and it looks like they always add the port to |
|
@mastahyeti They did pass for us: http://swarm.jquery.org/job/3970. Might be some flakeyness; make sure you use an up-to-date IE10 version as well. |
|
Hmm. I just ran Windows updates and I'm seeing the same test failure on master. Same thing in IE11. |
|
Just updated and installed all Windows Updates. I don't see any test fails on master using IE InPrivate Browsing. I have some known incompatible plugins that mess up the results if I don't use InPrivate. Same could be happening for you? In my case I'm pretty sure it's LastPass. I'll pull the updated PR in a few minutes and see if everything works here. |
|
Sorry. I'm I didn't realize that it was using |
Ajax: don't use new url parsing for url rewriting Ajax: cut down on unnecessary variables Ajax: fix indentation of multi-line statement Ajax: parse origin URL using an anchor tag too (for IE) Ajax: some IE fixes. IE only does URL cleanup on for .href IE also throws errors for malformed URLs.
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.
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.
Holy crap. Welcome to our cross-browser hell.
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.
Let's add a support comment about that.
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'll get that.
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.
Note sure if this will help, but here's a very similar solution with a giant comment about IE: https://github.com/angular/angular.js/blob/master/src/ng/urlUtils.js#L25
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.
Yeah it seems to boil down to almost the same thing.
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 wasn't sure if this should just fail closed, or cancel the request. If the URL is malformed, the request will end up failing either way...
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.
Yeah, did some head-scratching on this one and left it as-is with an enhanced comment.
|
Whew. This would have been so much easier if we had crummier unit tests and test matrix. 😈 I think both branches are good now, please take a look at the commits above and let me know if anything looks amiss. Thanks @mastahyeti! |
|
Thanks for all the help @dmethvin |
All support comments were checked for Edge applicability.


This PR changes the Ajax URL parsing from using a regex to using an anchor tag. This should be simpler and more reliable.
Fixes #1875
/cc @dmethvin