#6037 closed bug (duplicate)
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 (12)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
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.
comment:3 Changed 13 years ago by
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.
comment:4 Changed 13 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
Thanks for clearing this up, I appreciate it!
comment:5 Changed 13 years ago by
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) { }
}
comment:6 Changed 13 years ago by
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.
Changed 13 years ago by
Attachment: | test_abort.html added |
---|
Changed 13 years ago by
Attachment: | test_abort1.php added |
---|
Changed 13 years ago by
Attachment: | test_abort2.php added |
---|
comment:7 Changed 12 years ago by
Resolution: | → duplicate |
---|---|
Status: | reopened → closed |
Duplicate of #7018.
I haven't been able to reproduce this on my end - do you have any more information about what might be going on?