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 2000-05-18 23:43:23 +00:00
parent 2c27dd9b7c
commit 196c6ab8b3

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");