PDA

View Full Version : Ext.form.HtmlEditor rare but possible IFrame initialization failure



MaximGB
26 Oct 2010, 12:48 PM
Ext version tested:

Ext 3.x.x


Adapter used:

ext


css used:

only default ext-all.css


Browser versions tested against:

FF3 (firebug 1.5.4 installed)


Operating System:

WinXP Pro SP2


Description:
After editor rendering initIFrame() method is called via design mode monitoring task, in it's turn initIFrame() method starts document ready state monitoring task containing the following code:

var task = { // must defer to wait for browser to be ready
run : function(){
var doc = this.getDoc();
if(doc.body || doc.readyState == 'complete'){
Ext.TaskMgr.stop(task);
this.setDesignMode(true);
this.initEditor.defer(10, this);
}
},
interval : 10,
duration:10000,
scope: this
};
Ext.TaskMgr.start(task);

There's a possibility which can be catched that editor will be destroyed before that second monitoring task end, in this case this.getDoc() returns null and following condition check will raise doc is null error thus preventing Ext.TaskMgr.stop(task); from execution. So as the result firebug will report thousands of repeating doc is null errors.

Test Case:


Steps to reproduce the problem:

Test case consist of doing editor creation / detroying until you catch the case, takes me 8-10 times in average to create and kill panel with editor inside.

The result that was expected:
Error prone detroying ;)

The result that occurs instead:
Thousand of error due to constant timer handler function failure.

Screenshot or Video:
None

Debugging already done:
Yes, it's done ;)

Possible fix:

var task = { // must defer to wait for browser to be ready
run : function(){
var doc = this.getDoc();
if(doc && (doc.body || doc.readyState == 'complete')){
Ext.TaskMgr.stop(task);
this.setDesignMode(true);
this.initEditor.defer(10, this);
}
else if (!doc) {
Ext.TaskMgr.stop(task);
}
},
interval : 10,
duration:10000,
scope: this
};
Ext.TaskMgr.start(task);