Add the 'load' handler through timeout to push it down in the event queue a little. Otherwise, js barf when it fires the 'load' handler too early. Fix bug 37428. r=pavlov.

This commit is contained in:
slamm%netscape.com 2006-07-27 14:49:51 +00:00
parent 8e5d7b8da0
commit 416399ad45

View File

@ -99,6 +99,7 @@ function sidebar_overlay_init() {
sidebarObj.master_datasources += " chrome://communicator/content/sidebar/local-panels.rdf";
sidebarObj.master_resource = 'urn:sidebar:master-panel-list';
sidebarObj.component = document.firstChild.getAttribute('windowtype');
sidebar.loading_iframe = null;
debug("sidebarObj.component is " + sidebarObj.component);
// Initialize the display
@ -309,6 +310,7 @@ function is_excluded(item) {
function panel_loader() {
debug("---------- panel_loader");
dump_tree(this);
sidebar.loading_iframe = null;
this.removeEventListener("load", panel_loader, true);
this.removeAttribute('collapsed');
this.parentNode.firstChild.setAttribute('hidden','true');
@ -373,7 +375,11 @@ function update_panels() {
// Pick sandboxed, or unsandboxed iframe
var iframe = get_iframe(content);
iframe.removeAttribute('hidden');
iframe.addEventListener("load", panel_loader, true);
// Use a timeout to set the onload handler.
// Otherwise, this fires too early and javascript dies. Bug 37428.
sidebar.loading_iframe = iframe;
setTimeout("sidebar.loading_iframe.addEventListener('load', panel_loader, true);", 100);
}
} else {
debug("item("+ii+") unselected");