Hybrid View

    You found a bug! We've classified it as EXTJS-5799 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Ext JS Premium Member rstuart's Avatar
    Join Date
    Jan 2008
    Location
    Brisbane, Australia
    Posts
    140
    Vote Rating
    4
    rstuart is on a distinguished road

      0  

    Question Does the CORS option in Ext.data.Connection v4.0.7 actually work?

    Does the CORS option in Ext.data.Connection v4.0.7 actually work?


    It is clear the code was never tested as it has a basic error (Uses Ext.isIe instead of Ext.isIE), but if I manually fix that is it actually useable? My tests indicate that answer is no so-far.

    Code:
            Ext.isIe = Ext.isIE;
            Ext.Ajax.request({
                method: 'GET',
                cors: true,
                params: {
                    format: 'json'
                },
                url: 'http://some.random.domain/restaurants',
                success: function(response) {
                    var results = Ext.decode(response.responseText);
                    Str.Restaurant = results['Restaurants'][0];
                    Str.store.RestaurantLocations.loadData(Str.Restaurant['Locations']);
                    Str.restaurantPanel.update(Str.Restaurant);
                    win.show();
                    myMask.hide();
                },
                failure: function(response) {
                    myMask.hide();
                    Ext.Msg.show({
                        title: 'Booking Time Error',
                        msg: 'There was an error fetching the Restaurants from the server.\n\nReservation system won\'t be available.',
                        buttons: Ext.Msg.OK,
                        icon: Ext.Msg.ERROR
                    });
                }
            });
        });
    The success handler is never called. Instead, the request times out and the failure is called. This is despite the developer tools in IE9 showing the request succeeded. Does this feature work?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,118
    Vote Rating
    855
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    That is a bug and has been fixed in 4.1.0 beta 3 but I can confirm that it does work when that is fixed.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Ext JS Premium Member rstuart's Avatar
    Join Date
    Jan 2008
    Location
    Brisbane, Australia
    Posts
    140
    Vote Rating
    4
    rstuart is on a distinguished road

      0  

    Question


    Every indication I have is that even in beta3 it doesn't work. My failure still gets run in IE9 after the CORS request succeeds. There are no JavaScript errors and the request works in Firefox, Chrome and Safari. Even this simple example fails in IE:

    Code:
            Ext.onReady(function() {
                Ext.Ajax.request({
                    method: 'GET',
                    cors: true,
                    params: {
                        format: 'json'
                    },
                    url: 'http://xxxx:9200/restaurants/101',
                    success: function(response) {
                        alert('success');
                    },
                    failure: function(response) {
                        alert('failed');
                    }
                });
            });
    In Firefox, Safari and Chrome this gets an alert that says "success" almost immediately. In IE9, it gets a "failed" after a decent delay. You can see this example running on a live site with a CORS compatible URL here.

    Has this definitely been tested and is definitely working?

  4. #4
    Ext JS Premium Member rstuart's Avatar
    Join Date
    Jan 2008
    Location
    Brisbane, Australia
    Posts
    140
    Vote Rating
    4
    rstuart is on a distinguished road

      0  

    Exclamation


    To say that I am a little frustrated right now is an understatement. This code was obviously never tested - EVER - because it will just plain not work for IE.

    Line 52310 of ext-all-sandbox-debug-w-comments.js of 4.1beta3 reads as follows:

    Code:
    xhr.onreadystatechange = Ext.Function.bind(me.onStateChange, me, [request]);
    The XDomainRequest object used by Microsoft doesn't have such an event. It's events are onerror, onload, onprogress and ontimeout as described here. THIS CODE COULD NEVER OF WORKED!

    Is it any wonder that the current state of ExtJS 4 is in complete disarray. First you use Ext.isIe instead of Ext.isIE, then you are trying to bind to events that don't even EXIST!This is basic stuff! Just testing this code once will have shown this error. Seriously, JUST ONCE!

    If there is code like this in such a core part of the framework that has not been run or tested then it begs the question what else is hiding in ExtJS 4? It begs an even bigger question of me - how was I tricked into paying for this.

  5. #5
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,527
    Vote Rating
    379
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    Do you want me to move this thread to Bugs so that developers can fix it before the Ext 4.1 final is out?
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  6. #6
    Ext JS Premium Member rstuart's Avatar
    Join Date
    Jan 2008
    Location
    Brisbane, Australia
    Posts
    140
    Vote Rating
    4
    rstuart is on a distinguished road

      0  

    Default


    If you think there is any chance that it will be fixed by 4.1 then yeah, go for it.