Side navigation
#6037 closed bug (duplicate)
Opened February 05, 2010 03:04PM UTC
Closed October 09, 2010 04:15AM UTC
Last modified March 13, 2012 11:22PM UTC
oldAbort.call( xhr ) breaks in IE7 even within try/catch
Reported by: | bpottle | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.4.2 |
Component: | ajax | Version: | 1.4.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Still hunting for the source of this bug in the existing code -- might be better off putting together a barebones proof. I'll see if I can get that together.
ajax.js (line 463): try { var oldAbort = xhr.abort; xhr.abort = function() { if ( xhr ) { oldAbort.call( xhr ); // <-- *DIES HERE* } onreadystatechange( "abort" ); }; } catch(e) { }
Basically, in IE7 only, this line throws the error "Object does not support this property or method." IE8 is unaffected. Interestingly, Firefox with the latest version of Firebug will constantly show "200 Aborted" as the status for 90% of my $.ajax() calls when using jQuery 1.4.1 (even though they complete successfully and return my data), but when I comment this line out, they immediately start giving "200 OK" instead.
Additional question: Why does this error get thrown at all when wrapped in a try/catch like it is?
Also worth noting that there was a previous ticket on this block of code that errored on an attempt to set readyState in IE. It appears that was changed in 1.4.1.
Attachments (5)
Change History (7)
Changed February 06, 2010 05:19PM UTC by comment:1
Changed February 08, 2010 02:45PM UTC by comment:2
Sorry, something shiny ran by and I got distracted for a few days. I got partway through putting together a proof for this; I'll see if I can finish it and get it posted soon.
Changed February 09, 2010 05:50PM UTC by comment:3
I was able to strip down my page to barebones elements and narrow down the cause of this error.
It appears it lies not with jQuery 1.4.1, but the jquery.ajaxmanager.js plugin. I'm going to continue to investigate, but this ticket can be closed.
Changed February 10, 2010 06:22AM UTC by comment:4
resolution: | → invalid |
---|---|
status: | new → closed |
Thanks for clearing this up, I appreciate it!
Changed February 18, 2010 12:59PM UTC by comment:5
resolution: | invalid |
---|---|
status: | closed → reopened |
I have the same error in IE7 (not chrome, not firefox, not IE8).
I used jquery 1.4.2.
See my testcase.
I fixed the error with another try catch around the if block:
xhr.abort = function() {
try {
if ( xhr ) {
oldAbort.call( xhr );
}
} catch(e) { }
}
Changed March 11, 2010 12:46AM UTC by comment:6
I've also encountered the same issue in IE7 (IE6 and IE8 don't seem to be affected).
However, the suggested fix of wrapping the if statement in another try block doesn't always seem to do the trick. If you have a callback on the request's completion that interacts with the response at all (eg, just checking "res.status" on the XMLHttpRequest object passed to complete()), IE7 will throw an "Unpsecified error" and completely ignore your abort call. I'll attach test case files that demonstrate this if you attempt to fix it with the extra try block.
It seems like everything works as expected in IE7 if you never attempt to override the abort method at all.
I haven't been able to reproduce this on my end - do you have any more information about what might be going on?