PDA

View Full Version : Request variable undefined in AJAX connection when timeout



fbille
19 Jun 2011, 10:00 PM
Sencha Touch version tested:

1.1.0


Platform tested against:

Android 2.3.3 on HTC Incredible S
(Debugged in Google Chrome 12.0.742.100)


Description:

When the connection timeout kicks in, there is an error because the request variable is not defined.


Steps to reproduce the problem:

Setup a Ajax proxy (use a lower timeout so it shows quicker)
Make the connection to the server hang (f.ex. using DummyNet)
When the timeout occurs, observe that an error is thrown because the request variable is not defined.


Possible fix:

I changed line 265 in data/Connection.js to say "var request", and that solved it.

krause
1 Jul 2011, 9:33 AM
I don't think you should declare the request var. It would get rid of the javascript error, but there would still be an error in the code.
I think the problem is that instead of 'request' it should be just 'r' which is the function's argument.

Here is my proposed fix:



Ext.override(Ext.data.Connection, {

abort : function(r) {
if (r && this.isLoading(r)) {
if (!r.timedout) {
r.aborted = true;
}
// Will fire an onreadystatechange event
r.xhr.abort();
} else if (!r) {
var id;
for(id in this.requests) {
if (!this.requests.hasOwnProperty(id)) {
continue;
}
this.abort(this.requests[id]);
}
}
}

});


Regards

fbille
3 Jul 2011, 10:26 PM
You are right. This is duplicate of bug 129 (http://www.sencha.com/forum/showthread.php?134919-OPEN-129-Ext.data.Connection-s-abort()).