Skip to main content

Bug Tracker

Side navigation

#7787 closed bug (invalid)

Opened December 15, 2010 05:49PM UTC

Closed December 27, 2010 01:19AM UTC

Last modified March 14, 2012 02:26AM UTC

Ajax abort triggers failure event

Reported by: Owned by:
Priority: undecided Milestone: 1.6
Component: ajax Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:

I have an auto-suggest component that performs an Ajax look-up as you type, and it calls abort() if a previous look-up is already in progress. However, now in version 1.4.4, this intermittently triggers an onFailure event. The event handler gets error code 0 with an "unknown" error, which suggests to me the abort logic fails to detect that this was an intentional abort under some condition.

Unfortunately, I cannot provide my code, but it has been in use for a very long time, and this issue appeared when I upgraded from jQuery 1.4.2 to 1.4.4.

Attachments (0)
Change History (12)

Changed December 15, 2010 05:50PM UTC by anonymous comment:1

I forgot to mention this is in IE8

Changed December 15, 2010 06:23PM UTC by comment:2

This line looks wrong - is this double intentional? oldAbort, xhr );

If I change this to: oldAbort, xhr );

The problem I am having disappears.

Changed December 15, 2010 07:16PM UTC by jitter comment:3

component: unfiledajax
owner: →
status: newpending

Thanks for taking the time to contribute to the jQuery project by writing a bug report.

Your report is missing a test case thus I made one myself. live test case. But I couldn't reproduce your problem. Also what is the "onFailure" event (sounds like Prototype/Mootools).

Please read How to report bugs (especially the "Try a newer version of jQuery" and the "What To Provide" section).

Also make a test case on which reproduces your problem (and no this doesn't mean to post your production code). Test also with the jQuery WIP version (as there are some big changes in the ajax code since the release of 1.4.4) to make sure this hasn't been fixed already.

Then please report back and provide more information (especially browser/os versions) and the link to the test case.

Changed December 16, 2010 07:41PM UTC by comment:4

I'm seeing the same behavior. I was able to repro the error with jitter's live test case (when you type in the input, the firebug console output shows "error undefined", showing that the error callback is called on every abort). I was able to repro this in Safari, FF, and IE8.

Changed December 19, 2010 07:59AM UTC by comment:5

status: pendingnew

The test case you have provided shows the error quite well. The problem shows up in IE8 (I have not tried Safari). Just type into the input box and see the error callback is called with every abort, as noted by dhchow22.

As for "onFailure", that is simply the name of the callback function I assigned to the ajax error callback hook - sorry for the confusion.

Changed December 27, 2010 01:19AM UTC by snover comment:6

resolution: → invalid
status: newclosed

Thanks for the report, but this is not a jQuery bug.

The XHR spec does not provide a mechanism for determining whether or not a failed request was due to network error vs. an abortion, so it is not possible for jQuery to differentiate between them. There was a bug in 1.4.0-1.4.2 that caused error requests to be reported as successful; this was corrected in 1.4.3.

Unfortunately, because it’s impossible to override the abort handler in IE6, there is no way that jQuery can fix this issue in a fully cross-browser manner. Since both abortions and network failures do not result in a successful request, they both call the failure handler.

Changed December 27, 2010 04:23AM UTC by comment:7

You guys have totally misinterpreted this issue. It is a bug. Aborting an Ajax event should not trigger an error event. You have what looks like an invalid line of JavaScript in your code that, when corrected, fixes the problem.

Change oldAbort, xhr );

to oldAbort, xhr );

This is a bug and needs to be addressed. If it is not re-opened, I will file a new one.

Changed December 27, 2010 03:05PM UTC by jaubourg comment:8

Ajax has been highly re-architectured in the repository (1.4.5pre). The abort method of the native xhr is not dealt with like it used to be anymore.

Before crying "wolf", would you be so kind as to checkout jQuery from the repository and test your code against it or, at the very least, provide a minimal unit test we could include into jQuery's test chain to see if the issue is still there?

We want bugs to be solved as much as you do but you won't help us help you by refusing to provide a simple use case showing the bug.

You have to understand there are a lot of things that can go wrong in any Javascript code and, thus, *you* have to trim your code down to a minimal use case that makes it clear the problem is in ajax, not somewhere else. Then, we can use this code snippet, confirm the bug, include the test into our test suite, fix the issue and ensure it stays fixed for further releases. Saying "when I change line XXX, it's fixed" is not enough, seeing as you can't know what you're breaking by changing jQuery's code. On the other hand, we can assess that pretty easily... yet again, provided we have a usable test case.

So, to make it short: provide a use case that exhibits the bug against 1.4.5pre and the bug will be re-opened. In any other case, the bug stays invalid and closed.

Changed January 07, 2011 05:06PM UTC by comment:9

There is a live test case for this issue that clearly shows the problem, which is why I do not understand the response here. Also, there appears to be no option available in JSFIDDLE for "1.4.5pre". I have also pointed out in my comments, if you care to read them, where the bug actually is in your code - again, bewilderment emerges in my mind.

Test case is at and all you have to do is open it in Internet Explorer (8) and type into the input field. You will see that whenever the Ajax update is aborted, the error handler is executed - which is incorrect behavior.

In jQuery 1.4.4 code, the following line can be found: oldAbort, xhr );

If you change this to the following, the problem disappears: oldAbort, xhr );

If you can point me to where I can find 1.4.5pre, or make it available in Fiddle, I'll be happy to test it out. In the meantime, however, the problem is there, clearly demonstrable, and with a solution on hand, so... please check it out.

Changed January 07, 2011 05:11PM UTC by ajpiano comment:10

The 0 GIT version is a build from the latest revision of jQuery and can be considered to be at any given time.

Changed January 07, 2011 05:33PM UTC by comment:11

Replying to [comment:10 ajpiano]:

Thanks for the info - much appreciated.

I see the problem still exists.

Changed October 03, 2011 09:20AM UTC by anonymous comment:12

You just need to do proper ajax request

use $.ajax with global:false option