Skip to main content

Bug Tracker

Side navigation

#6256 closed bug (duplicate)

Opened March 10, 2010 12:21PM UTC

Closed October 27, 2010 05:28PM UTC

Last modified January 31, 2011 05:54PM UTC

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:
Description

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 );

}

onreadystatechange("abort");

};

} 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.

Notes:

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.

Attachments (0)
Change History (6)

Changed March 27, 2010 01:25PM UTC by vjt comment:1

Hello,

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,

~Marcello

Changed October 26, 2010 02:32PM UTC by addyosmani comment:2

#6471 is a duplicate of this ticket.

Changed October 27, 2010 05:28PM UTC by SlexAxton comment:3

cc: → snover, SlexAxton
keywords: → abort, xhr
milestone: 1.4.31.4.5
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

Changed October 27, 2010 05:28PM UTC by SlexAxton comment:4

Duplicate of #7018.

Changed January 31, 2011 05:53PM UTC by john comment:5

version: 1.4.21.5

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

Changed January 31, 2011 05:54PM UTC by john comment:6

milestone: 1.4.51.5

There was no 1.4.5 release, was actually 1.5.