szotyi
16 Feb 2008, 2:24 PM
I'm trying out Adobe AIR, but I'm stuck in the beginning and it looks like an ext issue. I made a simple example to show the problem. It prints out a window with a form in it. When the combobox get focus (tab into, select with mouse), I get an Unsafe JavaScript error. But if I comment out, the starred line everything is fine.
<html lang="hu">
<head>
<title>Model</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="ext-2.0/resources/css/ext-all.css">
<script type="text/javascript" src="AIRAliases.js"></script>
<script type="text/javascript" src="AIRIntrospector.js"></script>
<script type="text/javascript" src="ext-2.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-2.0/ext-all-debug.js"></script>
<script type="text/javascript">
var application = air.NativeApplication.nativeApplication;
</script>
<script type="text/javascript" src="ext-air/ext-air-debug.js"></script>
<script type="text/javascript">
Ext.onReady(function() {
Ext.BLANK_IMAGE_URL = "images/default/s.gif";
var data = [
['text','text'],
['parameter','parameter'],
['dblink','dblink'],
['undefined','undefined']
];
var store = new Ext.data.SimpleStore({
fields: ['name','value'],
data : data
});
Ext.form.Field.prototype.msgTarget = 'side';
var w = new Ext.Window({
width: 400,
height: 250,
layout: 'fit',
title: 'Set',
modal: true,
focus: function(){
//w.getEl().child("input[type!=hidden]").focus(); ****************
},
items: [{
xtype: 'form',
frame: true,
labelWidth: 120,
items: [
{
xtype: 'combo',
fieldLabel: 'Data type',
width: 230,
name: 'datatype',
store: store,
mode: 'local',
selectOnFocus: true,
forceSelection: true,
displayField: 'name',
valueField: 'value',
value: "text",
triggerAction: 'all',
tabIndex: 1
}
]
}],
buttons: [
{
text: 'Ok',
tabIndex: 2,
handler: function () {
w.close();
}
},
{
text: 'Cancel',
tabIndex: 3,
handler: function () {
w.close();
}
}
]
});
w.show();
air.Introspector.Console.log(w);
});
</script>
</head>
<body style="height: 100%" id="model"><div style="height: 100%" id="form-div"></div></body></html>
Here is the error trace:
Error: Unsafe JavaScript
at app:/ext-2.0/ext-all-debug.js : 6862
at app:/ext-2.0/ext-all-debug.js : 6862
at app:/ext-2.0/ext-all-debug.js : 17335
at app:/ext-2.0/ext-all-debug.js : 17335
at app:/ext-2.0/ext-all-debug.js : 12164
at app:/ext-2.0/adapter/ext/ext-base.js : 132
at app:/ext-2.0/adapter/ext/ext-base.js : 132
at app:/ext-2.0/ext-all-debug.js : 26727
at app:/ext-2.0/ext-all-debug.js : 26721
at app:/ext-2.0/ext-all-debug.js : 1413
at app:/ext-2.0/ext-all-debug.js : 1504
at app:/ext-2.0/ext-all-debug.js : 1504
at app:/ext-2.0/ext-all-debug.js : 1201
at app:/ext-2.0/ext-all-debug.js : 25508
at app:/ext-2.0/ext-all-debug.js : 26038
at app:/ext-2.0/ext-all-debug.js : 1629
at app:/ext-2.0/adapter/ext/ext-base.js : 785
undefined at undefined : undefined
Tried to look at the source, it could be some eval() thing, but couldn't figure it out. Too bad, that there is no breakpoint in AIR. Somebody any idea?
<html lang="hu">
<head>
<title>Model</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="ext-2.0/resources/css/ext-all.css">
<script type="text/javascript" src="AIRAliases.js"></script>
<script type="text/javascript" src="AIRIntrospector.js"></script>
<script type="text/javascript" src="ext-2.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-2.0/ext-all-debug.js"></script>
<script type="text/javascript">
var application = air.NativeApplication.nativeApplication;
</script>
<script type="text/javascript" src="ext-air/ext-air-debug.js"></script>
<script type="text/javascript">
Ext.onReady(function() {
Ext.BLANK_IMAGE_URL = "images/default/s.gif";
var data = [
['text','text'],
['parameter','parameter'],
['dblink','dblink'],
['undefined','undefined']
];
var store = new Ext.data.SimpleStore({
fields: ['name','value'],
data : data
});
Ext.form.Field.prototype.msgTarget = 'side';
var w = new Ext.Window({
width: 400,
height: 250,
layout: 'fit',
title: 'Set',
modal: true,
focus: function(){
//w.getEl().child("input[type!=hidden]").focus(); ****************
},
items: [{
xtype: 'form',
frame: true,
labelWidth: 120,
items: [
{
xtype: 'combo',
fieldLabel: 'Data type',
width: 230,
name: 'datatype',
store: store,
mode: 'local',
selectOnFocus: true,
forceSelection: true,
displayField: 'name',
valueField: 'value',
value: "text",
triggerAction: 'all',
tabIndex: 1
}
]
}],
buttons: [
{
text: 'Ok',
tabIndex: 2,
handler: function () {
w.close();
}
},
{
text: 'Cancel',
tabIndex: 3,
handler: function () {
w.close();
}
}
]
});
w.show();
air.Introspector.Console.log(w);
});
</script>
</head>
<body style="height: 100%" id="model"><div style="height: 100%" id="form-div"></div></body></html>
Here is the error trace:
Error: Unsafe JavaScript
at app:/ext-2.0/ext-all-debug.js : 6862
at app:/ext-2.0/ext-all-debug.js : 6862
at app:/ext-2.0/ext-all-debug.js : 17335
at app:/ext-2.0/ext-all-debug.js : 17335
at app:/ext-2.0/ext-all-debug.js : 12164
at app:/ext-2.0/adapter/ext/ext-base.js : 132
at app:/ext-2.0/adapter/ext/ext-base.js : 132
at app:/ext-2.0/ext-all-debug.js : 26727
at app:/ext-2.0/ext-all-debug.js : 26721
at app:/ext-2.0/ext-all-debug.js : 1413
at app:/ext-2.0/ext-all-debug.js : 1504
at app:/ext-2.0/ext-all-debug.js : 1504
at app:/ext-2.0/ext-all-debug.js : 1201
at app:/ext-2.0/ext-all-debug.js : 25508
at app:/ext-2.0/ext-all-debug.js : 26038
at app:/ext-2.0/ext-all-debug.js : 1629
at app:/ext-2.0/adapter/ext/ext-base.js : 785
undefined at undefined : undefined
Tried to look at the source, it could be some eval() thing, but couldn't figure it out. Too bad, that there is no breakpoint in AIR. Somebody any idea?