diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 53748fb4..207f554c 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -546,8 +546,8 @@ TreeStyleTabBrowser.prototype = { this.onPrefChange('extensions.treestyletab.tabbar.invertTabContents'); this.onPrefChange('extensions.treestyletab.tabbar.invertClosebox'); - var tabContextMenu = document.getAnonymousElementByAttribute(b, 'anonid', 'tabContextMenu') || - document.getAnonymousElementByAttribute(b.tabContainer, 'anonid', 'tabContextMenu'); + var tabContextMenu = b.tabContextMenu || + document.getAnonymousElementByAttribute(b, 'anonid', 'tabContextMenu'); tabContextMenu.addEventListener('popupshowing', this, false); if (!('MultipleTabService' in window)) { window.setTimeout(function(aSelf, aTabBrowser, aPopup) { @@ -1293,8 +1293,8 @@ TreeStyleTabBrowser.prototype = { this.scrollBox.removeEventListener('overflow', this, true); this.scrollBox.removeEventListener('underflow', this, true); - var tabContextMenu = document.getAnonymousElementByAttribute(b, 'anonid', 'tabContextMenu') || - document.getAnonymousElementByAttribute(b.tabContainer, 'anonid', 'tabContextMenu'); + var tabContextMenu = b.tabContextMenu || + document.getAnonymousElementByAttribute(b, 'anonid', 'tabContextMenu'); tabContextMenu.removeEventListener('popupshowing', this, false); var allTabPopup = document.getAnonymousElementByAttribute(b.mTabContainer, 'anonid', 'alltabs-popup'); diff --git a/modules/utils.js b/modules/utils.js index a9a44013..28eaf421 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -662,7 +662,10 @@ var TreeStyleTabUtils = { getTabStrip : function TSTUtils_getTabStrip(aTabBrowser) { - return aTabBrowser.mStrip || aTabBrowser.tabContainer.parentNode; + var strip = aTabBrowser.mStrip; + return (strip && strip.localName == 'hbox') ? + strip : + aTabBrowser.tabContainer.parentNode; }, get tabStrip() {