Bug Tracker

Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#6256 closed bug (duplicate)

IE8 AJAX GET request fails due to unexpected call to abort handler

Reported by: ratbert Owned by:
Priority: undecided Milestone: 1.5
Component: ajax Version: 1.5
Keywords: abort, xhr Cc: snover, SlexAxton
Blocked by: Blocking:


jquery 1.4.2 has the following code in the AJAX request handler:

Line 5229:

try {

var oldAbort = xhr.abort; xhr.abort = function() {

if ( xhr ) {

oldAbort.call( xhr );




} catch(e) { }

I'm no javascript expert, but the line "var oldAbort = xhr.abort;" doesn't look like a function call to me. On IE8 though it seems that the xhr.abort function is actually called and the xhr goes dead (ready state 1 -> 0) and the xhr.send() that follows then fails.

Hacking the line to "var oldAbort = null;" allows the xhr.send() to succeed and my AJAX request works.


This is not a proposed fix - good luck with that ;)

This form of override of current handlers, or callbacks, or whatever, is not uncommon in jQuery I think. I wonder how many other case there are that IE8 barfs on... Thanks a lot microsoft.

Change History (6)

comment:1 Changed 13 years ago by vjt


here is a patch for this issue that works on all browsers and make .abort () work correctly on IE{6,7,8}.

--- a/jquery-1.4.2.js
+++ b/jquery-1.4.2.js
@@ -5230,7 +5230,10 @@ jQuery.extend({
                        var oldAbort = xhr.abort;
                        xhr.abort = function() {
                                if ( xhr ) {
-          oldAbort.call( xhr );
+                                       if ( oldAbort.call !== undefined )
+                                               oldAbort.call( xhr );
+                                       else
+                                               oldAbort();
                                onreadystatechange( "abort" );

Against jquery.js 1.4.2.

Hope this helps,


comment:2 Changed 12 years ago by addyosmani

#6471 is a duplicate of this ticket.

comment:3 Changed 12 years ago by SlexAxton

Cc: snover SlexAxton added
Keywords: abort xhr added
Priority: undecided
Resolution: duplicate
Status: newclosed

This is a duplicate (notably of a newer bug), but since that one was marked as fixed. I'll mark this as such.

Does anyone have an opinion about calling oldAbort() like he does in the patch here? Is that safe? If anyone feels strongly about this, can you file an enhancement ticket for it? It'd be an easy addition.

The commit is here: https://github.com/jquery/jquery/commit/9b655a176b0d045c3773357761acf2fa93cd9650

comment:4 Changed 12 years ago by SlexAxton

Duplicate of #7018.

comment:5 Changed 12 years ago by john


There wasn't a 1.4.5 release, was actually 1.5.

comment:6 Changed 12 years ago by john


There was no 1.4.5 release, was actually 1.5.

Note: See TracTickets for help on using tickets.