PDA

View Full Version : request.xhr.readyState undefined for some AJAX calls



sissonb
31 Aug 2012, 2:18 PM
I am using the latest ExtJS 4.1.1. On line 54372 of ext-all-debug-w-comments.js I am getting the following error, "Uncaught TypeError: Cannot read property 'readyState' of undefined"

I am getting the error in chrome. It is intermittent.
Edit - I think the issue only occurs when I have breakpoints in the code.

This is the function that is failing,


/**
* Fires when the state of the xhr changes
* @private
* @param {Object} request The request
*/
onStateChange : function(request) {
if (request.xhr.readyState == 4) {
this.clearTimeout(request);
this.onComplete(request);
this.cleanup(request);
}
},


I could hide the issue by checking if request.xhr is null before checking if request.xhr.readyState is equalish to 4, but I don't want to change the library source code.

Here is a screencast of the issue, http://screencast.com/t/Z3gXas3n

Here is temporary version of the project. (library is over 5 MB so it might take a sec to load) http://adt.bgsisson.com/ADT/

(http://adt.bgsisson.com/ADT/)Any ideas about how to get rid of this error?

Thanks!

vietits
31 Aug 2012, 5:01 PM
You can use overriding. Example:


Ext.define('OverrideConnection', {
override: 'Ext.data.Connection',
onStateChange : function(request) {
if (request && request.xhr && request.xhr.readyState == 4) {
this.clearTimeout(request);
this.onComplete(request);
this.cleanup(request);
}
}
});

James Goddard
19 Sep 2012, 10:17 AM
Is there a fix pending for this or do we need to create a separate bug report so we don't have to all override data connection?

sissonb
19 Sep 2012, 10:30 AM
Once I removed my breakpoints the error stopped showing up. Also this error didn't break the program. I don't know if it's worth adding to the library. Are you getting this error too?

James Goddard
19 Sep 2012, 10:48 AM
Yes, I am getting it as well. It's a simple check, no reason not to add it to the library.

SebTardif
13 Nov 2012, 3:56 AM
Could this thread be moved to the bug thread? I can reproduce on 4.1.1.