Skip to content

Commit

Permalink
Hookup tab listener in window.load event because it looks to be getti…
Browse files Browse the repository at this point in the history
…ng undefined on tabContainer sometimes
  • Loading branch information
benmmurphy committed Nov 23, 2011
1 parent 4682744 commit fbc5ef1
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions chrome/content/overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]));
}
Expand All @@ -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);
Expand Down

0 comments on commit fbc5ef1

Please sign in to comment.