View Full Version : 1.1.0 Ext.data.Connection abort function coding error
touchy
29 Mar 2011, 4:47 AM
ReferenceError: Can't find variable: request sencha-touch-debug-w-comments.js:27636
In
abort : function(r) {
if (r && this.isLoading(r)) {
if (!request.timedout) {
request.aborted = true;
}
apparently request doesn't exist. Probably should be r.
We came across the same problem.
To stop the error and catch the exception we had to roll back this method to version 1.0
Ext.override(Ext.data.Connection, {
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) {
if (!this.requests.hasOwnProperty(id)) {
continue;
}
this.abort(this.requests[id]);
}
}
}
});
I'm not sure yet if this will cause other problems.
Anyone else have a better solution for this?
eboyer
19 Apr 2011, 7:52 AM
I tried, this and the below doesn't work, it results in XHR requests not working at all. :)
abort : function(r) {
if (r && this.isLoading(r)) {
if (!r.timedout) {
r.aborted = true;
}
r.xhr.abort();
}
The incoming r variable has the 'timedout' property.
abierbaum
29 Apr 2011, 12:42 PM
This hit me as well. I used this to "fix" it. (not sure if it is really fixed, but no exceptions)
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]);
}
}
}
});
hitman01
6 May 2011, 9:20 AM
Any official update to this?
Thanks for the patch, ianc. I ran into this problem as well. Unfortunately, it seems the r.xhr property is undefined by the time you get to onComplete. If you put a console.log(r.xhr) at the start of onComplete you'll see what I mean. This causes some problems. It seems like you're probably better off just not calling onComplete there at all. I note that even without that, my failureCallback does get called.
I'm pretty surprised this code made it out in a release because it would be trivial to find if they had a unit test that tests an aborted connection.
Podlipensky
9 Jun 2011, 8:01 PM
I was faced to the problem also. Seems like we have to wait until next release or user our own override as a temporary fix...
JacobGu
31 Oct 2011, 10:00 AM
I also repro this script error and resultant failed abort in 1.1.0, and verify that the override fix in this thread does indeed seem to resolve the bug.
thx
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.