Results 1 to 8 of 8

Thread: 1.1.0 Ext.data.Connection abort function coding error

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Touch Premium Member
    Join Date
    Aug 2010
    Posts
    104

    Default 1.1.0 Ext.data.Connection abort function coding error

    ReferenceError: Can't find variable: request sencha-touch-debug-w-comments.js:27636

    In

    Code:
        abort : function(r) {
            if (r && this.isLoading(r)) {
                if (!request.timedout) {
                    request.aborted = true;
                }
    apparently request doesn't exist. Probably should be r.

  2. #2
    Sencha Premium Member
    Join Date
    Sep 2010
    Posts
    3

    Default

    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

    Code:
    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?

  3. #3
    Sencha User
    Join Date
    Mar 2011
    Posts
    3

    Default Replacing request with 'r' is the best option here I believe

    I tried, this and the below doesn't work, it results in XHR requests not working at all.

    Code:
        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.
    Last edited by eboyer; 19 Apr 2011 at 7:57 AM. Reason: Testing.

  4. #4
    Ext JS Premium Member
    Join Date
    Oct 2010
    Posts
    103

    Default

    This hit me as well. I used this to "fix" it. (not sure if it is really fixed, but no exceptions)

    Code:
    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]);
                }
            }
        }
    });

  5. #5

    Default

    Any official update to this?
    http://www.dev4.life - Software Development Blog

  6. #6
    Sencha User jep's Avatar
    Join Date
    Sep 2010
    Posts
    862

    Default

    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.

  7. #7
    Sencha Premium Member
    Join Date
    Aug 2008
    Location
    USA
    Posts
    61

    Default

    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...
    My recent commitment into Sencha community:
    Star Rating Field: https://github.com/podlipensky/Ext.ux.touch.Rating
    Sencha Articles on my blog: http://podlipensky.com

  8. #8
    Sencha Premium Member
    Join Date
    Jul 2009
    Posts
    138

    Default

    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

Similar Threads

  1. [FIXED-506] Ext.data.Connection: conn.abort() aborts *all* instances
    By cdonnellytx in forum Sencha Touch 1.x: Bugs
    Replies: 2
    Last Post: 7 Nov 2010, 10:56 PM
  2. Replies: 1
    Last Post: 28 Jun 2010, 2:51 PM
  3. Replies: 2
    Last Post: 1 Feb 2010, 2:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •