Hybrid View

  1. #1
    Ext User
    Join Date
    Aug 2007
    Posts
    1
    Vote Rating
    0
    Erica is on a distinguished road

      0  

    Default AIR runtime security violation with sandbox issu!! plz help me.

    I'm trying to convert Extjs files to AIR file. But it has a serious problem!!! When I open in html, it works well. But It shows air runtime security violation error.
    Doesn't Ext2.0 support communicating data from external site?

    I made an air project and downloaded ext-2.0.2.
    I post here my sample codes plz help me.

    Except main.js , main.html file application.xml, I used exact same files(ext-2.0.2 including AIR) with in Simple Taks V2.

    This sample file shows combo box containg lists which is from specific ip address.
    It shows error :
    Error: Adobe AIR runtime security violation for JavaScript code in the application security sandbox (Function constructor)
    - main.html-------------------------------------------------------------------------
    <html>
    <head>
    <title>Absolute Forms</title>
    <script type="text/javascript" src="AIRAliases.js"></script>
    <script type="text/javascript" src="AIRIntrospector.js"></script>

    <link rel="stylesheet" type="text/css" href="ext-2.0.2/resources/css/ext-all.css"/>
    <link rel="stylesheet" type="text/css" href="ext-2.0.2/air/resources/ext-air.css" />

    <!-- GC -->
    <!-- LIBS -->
    <script type="text/javascript" src="ext-2.0.2/adapter/ext/ext-base.js"></script>
    <script type="text/javascript" src="ext-2.0.2/ext-all.js"></script>
    <script type="text/javascript" src="ext-2.0.2/air/ext-air.js"></script>
    <!-- ENDLIBS -->

    <script type="text/javascript" src="main.js"></script>
    <link rel="stylesheet" type="text/css" href="forms.css"/>
    </head>
    <body>
    </body>
    </html>

    - main.js----------------------------------------------------------------------------
    /*
    * Ext JS Library 2.0.2
    * Copyright(c) 2006-2008, Ext JS, LLC.
    * licensing@extjs.com
    *
    * http://extjs.com/license
    */
    Ext.onReady(function() {

    var dataStore = new Ext.data.Store({
    proxy: new Ext.data.HttpProxy({
    url: 'http://165.213.147.60/air/data.php',
    method:'post'
    }),
    baseParams:{
    method:'getTableInfoList'
    },
    reader: new Ext.data.JsonReader(
    {
    root:'rows'
    },
    [
    {name: 'title', mapping: 'title'},
    {name: 'tms_tableinfo_uid', mapping: 'tms_tableinfo_uid'}
    ])
    });

    dataStore.sort('title');
    dataStore.load();

    comboBox = new Ext.form.ComboBox({
    mode: 'local',
    typeAhead: false,
    triggerAction: 'all',
    queryDelay: 500,
    editable:false,
    store: dataStore,
    valueField:'tms_tableinfo_uid',
    displayField: 'title',
    hiddenName:'tms_tableinfo_uid',
    loadingText: 'Loading Proejct',
    fieldLabel: 'Item',
    selectOnFocus:true,
    allowBlank:false,
    anchor:'50%'
    });

    var form = new Ext.form.FormPanel({
    baseCls: 'x-plain',
    layout:'absolute',
    url:'save-form.php',
    defaultType: 'textfield',
    items: [comboBox]
    });
    var window = new Ext.Window({
    title: 'Resize Me',
    width: 500,
    height:300,
    minWidth: 300,
    minHeight: 200,
    layout: 'fit',
    plain:true,
    bodyStyle:'padding:5px;',
    buttonAlign:'center',
    items: form,
    buttons: [{
    text: 'Send'
    },{
    text: 'Cancel'
    }]
    });
    window.show();
    });
    --------------------------------------------------------------------------------------
    'http://165.213.147.60/air/data.php has only following texts. (You cannot access the ip address because it's a private website.)


    {'rows':[{tms_tableinfo_uid:0, title:'first'},{tms_tableinfo_uid:1, title:'second'}]}

  2. #2
    Sencha User
    Join Date
    Sep 2007
    Posts
    13,974
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default

    Give the ComboBox a template that isnt defined in the "onready" block.

  3. #3
    Sencha User Juvs's Avatar
    Join Date
    Oct 2007
    Posts
    36
    Vote Rating
    2
    Juvs is on a distinguished road

      0  

    Default

    Erica,

    Did you find a solution for your app?

  4. #4
    Sencha Premium Member MichaelOstrovsky's Avatar
    Join Date
    May 2008
    Location
    Tel Aviv, Israel
    Posts
    141
    Vote Rating
    6
    MichaelOstrovsky is on a distinguished road

      0  

    Default

    i have similar problem please help.

    btw,

    "Give the ComboBox a template that isnt defined in the "onready" block. "

    - what did you mean by it and how to do it ?

  5. #5
    Ext User
    Join Date
    Nov 2007
    Posts
    102
    Vote Rating
    0
    RobSmith is on a distinguished road

      0  

    Default

    Have a look at these threads regarding the template issue:

    http://extjs.com/forum/showthread.php?t=45979
    http://extjs.com/forum/showthread.php?t=32431

  6. #6
    Ext User
    Join Date
    Nov 2007
    Posts
    102
    Vote Rating
    0
    RobSmith is on a distinguished road

      0  

    Default

    I experienced the same problem when using panels which will be rendered later on (tab panel items). This indeed seems to be a problem for the sandbox security . As a workaround I would suggest to create only the template object on initial rendering:

    PHP Code:
    Ext.onReady(function(){
        
    mynamespace.mytpl = new Ext.XTemplate(
                
    '<tpl for="."><div class="x-combo-list-item">{fieldname}</div></tpl>'
            
    );
    }); 
    When creating your combobox later on you can use this template without any problems:

    PHP Code:
    new Ext.form.ComboBox({
      <
    attributes>
      
    tplmynamespace.mytpl,
      .
      .