Bug Tracker

Opened 14 years ago

Closed 13 years ago

Last modified 11 years ago

#3939 closed bug (fixed)

IE7 Line 3427 (jQuery 1.3 rev6104) xhr.readyState is null or not an object

Reported by: jfk Owned by:
Priority: major Milestone: 1.3
Component: ajax Version: 1.3
Keywords: XMLHttpRequest AJAX Cc:
Blocked by: Blocking:


Shows only in IE7. I think this bug shows because one crucial check is absent.

Offending line (3427): if (xhr.readyState == 0) {

Fixed line: if (xhr && xhr.readyState == 0) {

The bug manifests when timeout is set in $.ajax options. Regretably, I don't have sufficient time to make solid test case.

Attachments (1)

jQueryBug3939.aspx (1.4 KB) - added by jfk 14 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 14 years ago by dmethvin

Reviewing the code, it does seem like there could be situations where this could happen. When the request completes for any reason on an async request, xhr is set to null. However, the if (xhr.readyState == 0) leg does not set requestDone to true. If the timeout checker fires after that, it would go through onreadystatechange with a null xhr object.

A test case would help, but if you can't make one could you say a bit more about when this happens? Is it solidly reproducible or kind of sporadic?

Changed 14 years ago by jfk

Attachment: jQueryBug3939.aspx added

comment:2 Changed 14 years ago by jfk

OK, I've found some time for test case, see attachement. I tested on FF3, IE6/XP, IE7/Vista, IE8/Vista, Opera, Chrome, Safari (latest stable versions). The only one which spits error is IE7/Vista.

comment:3 Changed 14 years ago by dmethvin

Thanks for creating the test. Definitely looks like a timeout situation.

comment:4 Changed 14 years ago by jfk

I've tested this bug on jQuery 1.3.1 and it is still present.

comment:5 Changed 14 years ago by mauricei

I've been getting the same error in my application since update to 1.3 and up to 1.3.2. For me it occurs in all version of IE (IE6/XP, IE7/XP, IE8/Vista).

I tried adding a check to see if xhr was defined as suggested and it does fix the javascript error. The problem is that the ival variable is also null so without any javascript error the interval keeps executing indefinitely (>1000 method calls in a couple of seconds).

I will keep on trying to make a simple test case but have not yet found a way to reproduce it outside my application.

comment:6 Changed 14 years ago by pawprint_net

I am having this same problem - again would be very difficult to create a standalone test case. but will provide any information that I can if requested.

comment:7 Changed 14 years ago by dev

I'm getting same error on IE6 and jQuery 1.3.2
On removing timeout property, the jQuery kept trying request for 55 seconds (on a simulated server delay).

comment:8 Changed 14 years ago by damonmiller513

I am getting this same issue. I'm using IE8/Vista and jQuery 1.3.2. The issue only occurs when setting a timeout for the XHR call and if the request actually does timeout.

I came to the same conclusion that modifying the error line to 'if (xhr && xhr.readyState == 0) {' stops the issue. However, I do not know if this would have other issues doing this.

comment:9 Changed 13 years ago by dmethvin

Resolution: fixed
Status: newclosed

This bug was fixed in 1.4.

Note: See TracTickets for help on using tickets.