PDA

View Full Version : [FIXED-82](0.85) Ext.data.Connection.abort() & isLoading() : r.xhr is undefined



watrboy00
16 Jun 2010, 8:48 PM
/**
* Determine whether this object has a request outstanding.
* @param {Number} transactionId (Optional) defaults to the last transaction
* @return {Boolean} True if there is an outstanding request.
*/
isLoading : function(r) {
// if there is a connection and readyState is not 0 or 4
return r && !{0:true,4:true}[r.xhr.readyState];
},

/**
* Aborts any outstanding request.
* @param {Number} transactionId (Optional) defaults to the last transaction
*/
abort : function(r) {
if (r && this.isLoading(r)) {
r.xhr.abort();
clearTimeout(r.timeout);
delete(r.timeout);
r.aborted = true;
this.onComplete(r);
}
else if (!r) {
var id;
for(id in this.requests) {
this.abort(this.requests[id]);
}
}
}

Haven't done much debugging on this one but it seems that the XHR object doesn't get patched in to the request object contained in the requests collection. Even though it looks like it does...


// create the transaction object
request = {
id: ++Ext.data.Connection.requestId,
xhr: xhr,
headers: headers,
options: o,
timeout: setTimeout(function() {
request.timedout = true;
me.abort(request);
}, o.timeout || me.timeout)
};
me.requests[request.id] = request;

I will see if I can get a test case up demoing this.

TommyMaintz
28 Jun 2010, 2:51 PM
I think this is fixed in the new release. I have tested and was able to abort requests. The request method returns the request object now, which you can pass to abort. Could you test this after the new release (due tomorrow)?