Bug 553691 - Stop using setTimeout to initialize the browser tools panel [r=vingtetun]
--- 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) {