Opened 10 years ago
Closed 10 years ago
#12635 closed bug (fixed)
jquery 1.8.2 fails ajax calls in IE9 because it assumes cross domain when default port is in ajax url
Reported by: | Owned by: | gibson042 | |
---|---|---|---|
Priority: | high | Milestone: | 1.8.3 |
Component: | ajax | Version: | 1.8.2 |
Keywords: | Cc: | gibson042 | |
Blocked by: | Blocking: |
Description
We upgraded from 1.7.2 to 1.8.2, and I was able to track down the offending javascript:
In version 1.7.2 we had this to test crossdomain:
crossDomain = !!( parts && ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] || ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
In version 1.8.2 we have this:
crossDomain = parts && ( parts.join(":") + ( parts[ 3 ] ? "" : parts[ 1 ] === "http:" ? 80 : 443 ) ) !== ( ajaxLocParts.join(":") + ( ajaxLocParts[ 3 ] ? "" : ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) );
Notice how in 1.8.2 it also requires the [0] element of the array to be the same, this would not be the case for "http://www.slashdot.org" and "http://www.slashdot.org:80" for example.
A solution with minimal change would be this:
crossDomain = parts && ( parts.slice(1).join(":") + ( parts[ 3 ] ? "" : parts[ 1 ] === "http:" ? 80 : 443 ) ) !== ( ajaxLocParts.slice(1).join(":") + ( ajaxLocParts[ 3 ] ? "" : ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) );
Change History (7)
comment:1 follow-ups: 2 3 Changed 10 years ago by
Cc: | gibson042 added |
---|
comment:2 Changed 10 years ago by
Replying to jaubourg:
I though this was unit tested. Could you provide a jsFiddle demonstrating the issue?
If it's verified, then it's a case of size-optimization gone wrong.
A fiddle: http://jsfiddle.net/pqpT2/3/
comment:3 Changed 10 years ago by
Replying to jaubourg:
I though this was unit tested. If it's verified, then it's a case of size-optimization gone wrong.
I've added a fiddle unit test to the default set to demonstrate the problem in this fiddle: http://jsfiddle.net/gcRn7/
comment:4 Changed 10 years ago by
Woah, fantastic benjamin! Thanks so much for this. I owe you a beer now!
comment:5 Changed 10 years ago by
Wow, I also thought it was tested, but benjamin is exactly right. Facepalm on my part for breaking it and for incomplete coverage.
comment:6 Changed 10 years ago by
Component: | unfiled → ajax |
---|---|
Milestone: | None → 1.8.3 |
Owner: | set to gibson042 |
Priority: | undecided → high |
Status: | new → assigned |
comment:7 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fix #12635: restore 1.8.1 ajax crossDomain logic. Close gh-944.
Changeset: da3ff3afe4d8421ae4ad04d6653f04ed6d7768e3
I though this was unit tested. Could you provide a jsFiddle demonstrating the issue?
If it's verified, then it's a case of size-optimization gone wrong.