diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index 5dcae43a..be8dbd8c 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -1196,51 +1196,54 @@ catch(e) { funcs = 'handleLinkClick __splitbrowser__handleLinkClick __ctxextensions__handleLinkClick __treestyletab__highlander__origHandleLinkClick'.split(' '); for (var i in funcs) { - if (funcs[i] in window && /^function handleLinkClick/.test(window[funcs[i]].toString())) - eval('window.'+funcs[i]+' = '+ - window[funcs[i]].toSource().replace( - /(openNewTabWith\()/g, - <> - ).replace( - /(event.ctrlKey|event.metaKey)/, - <> - ).replace( - 'return false;case 1:', - <> - ) - ); + if (!(funcs[i] in window) || + !/^function handleLinkClick/.test(window[funcs[i]].toString())) + continue; + eval('window.'+funcs[i]+' = '+ + window[funcs[i]].toSource().replace( + /(openNewTabWith\()/g, + <> + ).replace( + /(event.ctrlKey|event.metaKey)/, + <> + ).replace( + 'return false;case 1:', + <> + ) + ); + break; } funcs = 'contentAreaClick __contentAreaClick __ctxextensions__contentAreaClick'.split(' '); diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 6fea4c6a..87e3fb3c 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -457,7 +457,9 @@ TreeStyleTabBrowser.prototype = { }, 0, this); var allTabPopup = document.getAnonymousElementByAttribute(b.mTabContainer, 'anonid', 'alltabs-popup'); - allTabPopup.addEventListener('popupshowing', this, false); + if (allTabPopup) { + allTabPopup.addEventListener('popupshowing', this, false); + } /* To move up content area on the tab bar, switch tab. If we don't do it, a gray space appears on the content area @@ -827,7 +829,9 @@ TreeStyleTabBrowser.prototype = { tabContext.removeEventListener('popuphiding', this, false); var allTabPopup = document.getAnonymousElementByAttribute(b.mTabContainer, 'anonid', 'alltabs-popup'); - allTabPopup.removeEventListener('popupshowing', this, false); + if (allTabPopup) { + allTabPopup.removeEventListener('popupshowing', this, false); + } if (this.tabbarCanvas) { this.tabbarCanvas.parentNode.removeChild(this.tabbarCanvas);