Bug 553691 - Stop using setTimeout to initialize the browser tools panel [r=vingtetun]
authorMark Finkle <mfinkle@mozilla.com>
Sat, 20 Mar 2010 17:33:35 -0400
changeset 66051 2fc3ba5ed8106f56fcc89791526fba9f19277eaf
parent 66050 e97d7d84f68a67b1234fbf4d80c277f02da54917
child 66052 23a15399e6ffbd56ef51eac2d408eb8c22fa3572
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvingtetun
bugs553691
Bug 553691 - Stop using setTimeout to initialize the browser tools panel [r=vingtetun]
mobile/chrome/content/browser-ui.js
--- a/mobile/chrome/content/browser-ui.js
+++ b/mobile/chrome/content/browser-ui.js
@@ -405,25 +405,30 @@ var BrowserUI = {
 
     // listening mousedown for automatically dismiss some popups (e.g. larry)
     window.addEventListener("mousedown", this, true);
 
     // listening escape to dismiss dialog on VK_ESCAPE
     window.addEventListener("keypress", this, true);
 
     // Push the panel initialization out of the startup path
-    // (Using a timeout because we have no good way to delay-init [Bug 535366])
-    setTimeout(function() {
+    // (Using an event because we have no good way to delay-init [Bug 535366])
+    browsers.addEventListener("load", function() {
+      // We only want to delay one time
+      browsers.removeEventListener("load", arguments.callee, false);
+      
       // We unhide the panelUI so the XBL and settings can initialize
       Elements.panelUI.hidden = false;
+
+      // Init the views
       ExtensionsView.init();
       DownloadsView.init();
       PreferencesView.init();
       ConsoleView.init();
-    }, 1000);
+    }, false);
   },
 
   uninit : function() {
     ExtensionsView.uninit();
     ConsoleView.uninit();
   },
 
   update : function(aState) {