Hybrid View

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    4
    Vote Rating
    0
    jdspdx is on a distinguished road

      0  

    Default JSONP requests failing after first call

    JSONP requests failing after first call


    Version tested: Sencha Touch 1.1.1

    Subsequent JSONP requests do not execute after a request which does not return successfully. Additionally, there seems to be an issue with subsequent calls even when the return is a success. Setting "Ext.util.JSONP.current = undefined" works around the latter issue and allows more calls to be made. This does not work when the call fails, however.

    The following code demonstrates the problem. The 'valid' services called are public Flickr services, and the the invalid call is to localhost:82 which is assumed to be closed.

    Code to reproduce:
    Code:
    <!DOCTYPE html>
    <html>
    <head>
        <script src="src/sencha-touch-debug-w-comments.js"></script>
        <script>
            // Flickr callback
            function jsonFlickrFeed(data) {
                console.log("callback invoked");
                console.dir(data);
    
    
                // Without this statement, NO subsequent JSONP requests execute, regardless of success/failure.
                Ext.util.JSONP.current = undefined;
            }
            Ext.onReady(function () {
                // This will succeed.
                console.log("calling valid service");
                Ext.util.JSONP.request({
                    url:'http://www.flickr.com/services/feeds/photos_public.gne?format=json'
                });
    
    
                // This will fail
                setTimeout(function () {
                    console.log("calling invalid jsonp service");
                    try {
                        Ext.util.JSONP.request({
                           url:'http://127.0.0.1:82'
                       });
                    } catch (e) {
                        console.log(e);
                    }
                }, 1000);
    
    
                // This will never execute.
                setTimeout(function () {
                    console.log("retrying valid service");
                    try {
                        Ext.util.JSONP.request({
                            url:'http://api.flickr.com/services/feeds/forums.gne?format=json'
                        });
                    } catch (e) {
                        console.log(e);
                    }
                }, 4000);
            });
        </script>
    </head>
    <body>
    </body>
    </html>
    Last edited by jdspdx; 6 Mar 2012 at 7:44 PM. Reason: code displaying improperly

  2. #2
    Sencha User
    Join Date
    Mar 2012
    Posts
    4
    Vote Rating
    0
    jdspdx is on a distinguished road

      0  

    Default


    This appears to be because Ext.util.JSONP does not support static callback names properly.

    Does this snippet of code in Ext.util.JSONP.request make sense?

    Code:
     if (o.callbackKey) {
                o.params[o.callbackKey] = 'Ext.util.JSONP.callback';
            }
    This results in a URL parameter of the form "MyCode.callback=Ext.util.JSONP.callback".

    The state (Ext.util.JSONP.current) is never getting properly reset, because Ext.util.JSONP.callback never executes.

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    4
    Vote Rating
    0
    jdspdx is on a distinguished road

      0  

    Default


    There's also insufficient error handling for when JSONP requests fail. No exceptions are thrown that are catchable. How is one supposed to determine whether or not a request failed?

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi