Correctly update "list all tabs" menu if there is pinned tabs + simplify

This commit is contained in:
Infocatcher 2013-11-18 12:01:23 +04:00
parent 8b77d49cca
commit ff9023012f

View File

@ -444,28 +444,10 @@ TreeStyleTabWindow.prototype = {
if (!utils.getTreePref('enableSubtreeIndent.allTabsPopup')) if (!utils.getTreePref('enableSubtreeIndent.allTabsPopup'))
return; return;
var items = Array.slice(aEvent.originalTarget.childNodes); Array.forEach(aEvent.originalTarget.childNodes, function(aItem) {
var firstItemIndex = 0; if (aItem.classList.contains('alltabs-item') && 'tab' in aItem)
// ignore menu items inserted by Weave (Firefox Sync), Tab Utilities, and others. aItem.style.marginLeft = aItem.tab.getAttribute(this.kNEST) + 'em';
for (let i = 0, maxi = items.length; i < maxi; i++) }, this);
{
let item = items[i];
if (
item.getAttribute('anonid') ||
item.id ||
item.hidden ||
item.localName != 'menuitem'
)
firstItemIndex = i + 1;
}
items = items.slice(firstItemIndex);
var b = this.getTabBrowserFromChild(aEvent.originalTarget) || this.browser;
var tabs = this.getTabs(b);
for (let i = 0, maxi = tabs.length; i < maxi; i++)
{
items[i].style.marginLeft = tabs[i].getAttribute(this.kNEST)+'em';
}
}, },
initUIShowHideObserver : function TSTWindow_initUIShowHideObserver() initUIShowHideObserver : function TSTWindow_initUIShowHideObserver()