Opened 15 years ago

Closed 15 years ago

#3395 closed defect (fixed)

RichText widget has several bugs related to the page loading

Reported by: bradneuberg Owned by: liucougar
Priority: high Milestone: 0.9
Component: Editor Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bradneuberg)

This bug is caused by three issues in the RichText? widget; I don't have a fix though.

1) On line 577:

detect firefox < 1.5, which has some iframe loading issues

var oldMoz = Boolean(dojo.isMoz && (typeof window.XML == 'undefined'));

this flag is set for versions of Firefox older than 1.5. Then, on line 702 we have the following:


ifrFunc(); iframe already exists, just set content

}else if(dojo.isMoz){

FIXME: if we put this on a delay, we get a height of 20px. Otherwise we get the correctly specified minHeight value.

setTimeout(ifrFunc, 250);

}else{ new mozillas, opera, safari



The second if/else, which has if(dojo.isMoz), I believe should be if(oldMoz) so that things happen on a setTimeout. I am using Firefox 2, so I believe that setTimeout should never have been called for me.

2) If we have a setTimeout(), for older versions of Firefox, then what happens is the widget initialization continues and the widget system 'incorrectly' thinks the widget system is initialized, which means the page's onLoad event gets fired before the widget is truly finished initializing. This can lead to bugs in developer code which starts accessing this widget, but it is not available yet.

3) If we fall to the third if/else, and just execute ifrFunc() immediately, then what happens is we get an error on line 669:

this.document.body.innerHTML = html;

However, we don't have a document.body yet since the page isn't finished loading.

Change History (5)

comment:1 Changed 15 years ago by bill

Can you be more specific than "However, if you go through the dojo.addOnLoad method inside of loader.js you find that this is not true."? Maybe provide a test case and/or explain why you believe this is happening?

comment:2 Changed 15 years ago by bradneuberg

Description: modified (diff)
Summary: Page load event being fired by Dojo even though widgets aren't ready to goRichText widget has several bugs related to the page loading

The dojo.addOnLoad() method claims that it will not get fired unless both the page is finished loading AND the widget system is ready to go and parsed:


Registers a function to be triggered after the DOM has finished loading and widgets declared in markup have been instantiated. Images and CSS files may or may not have finished downloading when the specified function is called. (Note that widgets' CSS and HTML code is guaranteed to be downloaded before said widgets are instantiated.)

However, if you go through the dojo.addOnLoad method inside of loader.js you find that this is not true.

This creates a bug for me in Moxie, since the page load event fires _before_ my RichText? widget is ready to go, creating exceptions since the RichText? widget isn't initialized correctly.

Assigning severity 'major' because this will trip up lots of users waiting to work with the Dijit widgets they just put on the page.

comment:3 Changed 15 years ago by bradneuberg

severity: majornormal

comment:4 Changed 15 years ago by bill

Component: GeneralEditor
Milestone: 0.9
Owner: changed from anonymous to liucougar

Wow, we aren't even supporting FF1.5, let alone versions that are *older* that 1.5. Let's just get rid of all that code. Feel free to make the change yourself (that will be the quickest way for it to get done).

comment:5 Changed 15 years ago by liucougar

Resolution: fixed
Status: newclosed

(In [9683]) fixes #3395: we need setTimeout for mozilla/firefox to fix 3); please use onLoadDeferred object in the richtext widget to get notified when it is ready

Note: See TracTickets for help on using tickets.