Side navigation
#12635 closed bug (fixed)
Opened October 01, 2012 11:50AM UTC
Closed October 04, 2012 01:49AM UTC
jquery 1.8.2 fails ajax calls in IE9 because it assumes cross domain when default port is in ajax url
Reported by: | benjamin.haentjens@ordina.be | 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 ) );
Attachments (0)
Change History (7)
Changed October 01, 2012 12:33PM UTC by comment:1
cc: | → gibson042 |
---|
Changed October 01, 2012 12:48PM UTC by comment:2
Replying to [comment:1 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:
Changed October 01, 2012 06:12PM UTC by comment:3
Replying to [comment:1 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:
Changed October 01, 2012 06:16PM UTC by comment:4
Woah, fantastic benjamin! Thanks so much for this. I owe you a beer now!
Changed October 03, 2012 02:59AM UTC by comment:5
Wow, I also thought it was tested, but benjamin is exactly right. Facepalm on my part for breaking it and for incomplete coverage.
Changed October 03, 2012 12:27PM UTC by comment:6
component: | unfiled → ajax |
---|---|
milestone: | None → 1.8.3 |
owner: | → gibson042 |
priority: | undecided → high |
status: | new → assigned |
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.