Feb 21, 2013, 8:18 AM
Possible bug in Safari with fireEvent
Hi,
I noticed that when I call:
and after some tracing, the problem was located in
Ext.util.Observable.fireEvent()
I get this case only with the record.set() function, I didn't found this kind of error in other fireEvent cases. This is tested in the latest Safari for Windows (5.1.7) and for Mac OS X (6.0.2).
By the way I solved the problem with overriding this function, and wrapping the problematic code with try-catch block, but I was wondering if someone else got the same problem, and what kind of solution is used.
I noticed that when I call:
var record = #{MyGrid}.getStore().getById(record_id);
record.set('some_data', 'test');
In Safari this code throws an error: 'undefined is not an object' and after some tracing, the problem was located in
Ext.util.Observable.fireEvent()
fireEvent: function () {
var a = Array.prototype.slice.call(arguments, 0),
ename = a[0].toLowerCase(),
me = this,
ret = true,
ce = me.events[ename],
cc,
q,
c;
if (me.eventsSuspended === true) {
if (q = me.eventQueue) {
q.push(a);
}
}
else if (typeof ce == 'object') {
if (ce.bubble) {
if (ce.fire.apply(ce, a.slice(1)) === false) {
return false;
}
c = me.getBubbleTarget && me.getBubbleTarget();
if (c && c.enableBubble) {
cc = c.events[ename];
if (!cc || typeof cc != 'object' || !cc.bubble) {
c.enableBubble(ename);
}
return c.fireEvent.apply(c, a);
}
}
else {
a.shift();
ret = ce.fire.apply(ce, a);
}
}
return ret;
}
The problem was in this line of code at the end:ret = ce.fire.apply(ce, a);
I don't now but somehow Safari throws an error, and this is native javascript function, so I suspect it's some internal error in the Safari Javascript engine.I get this case only with the record.set() function, I didn't found this kind of error in other fireEvent cases. This is tested in the latest Safari for Windows (5.1.7) and for Mac OS X (6.0.2).
By the way I solved the problem with overriding this function, and wrapping the problematic code with try-catch block, but I was wondering if someone else got the same problem, and what kind of solution is used.