Permalink
Browse files

Hookup tab listener in window.load event because it looks to be getti…

…ng undefined on tabContainer sometimes
  • Loading branch information...
benmmurphy committed Nov 23, 2011
1 parent 4682744 commit fbc5ef1a96984d53bc2f006510c05473625e89ee
Showing with 13 additions and 9 deletions.
  1. +13 −9 chrome/content/overlay.js
View
@@ -42,12 +42,13 @@
};
function load() {
-
+ hookup_tabs();
document.getElementById("jsbStatus").addEventListener("click", toggle, false);
update_text();
};
function unload() {
+ var container = gBrowser.tabContainer;
for (var i = 0; i < container.childNodes.length; ++i) {
jsbeautifier.remove(gBrowser.getBrowserForTab(container.childNodes[i]));
}
@@ -70,14 +71,17 @@
update_text();
};
-
- var container = gBrowser.tabContainer;
- container.addEventListener("TabOpen", tabOpen, false);
- container.addEventListener("TabClose", tabClose, false);
- container.addEventListener("TabSelect", tabSelect, false);
-
- for (var i = 0; i < container.childNodes.length; ++i) {
- jsbeautifier.add(gBrowser.getBrowserForTab(container.childNodes[i]), window.Worker);
+
+ function hookup_tabs() {
+ var container = gBrowser.tabContainer;
+ if (container) {
+ container.addEventListener("TabOpen", tabOpen, false);
+ container.addEventListener("TabClose", tabClose, false);
+ container.addEventListener("TabSelect", tabSelect, false);
+ for (var i = 0; i < container.childNodes.length; ++i) {
+ jsbeautifier.add(gBrowser.getBrowserForTab(container.childNodes[i]), window.Worker);
+ }
+ }
}
window.addEventListener("load", load, false);

0 comments on commit fbc5ef1

Please sign in to comment.