Bug 321490: Make SeaMonkey compatible again with moveTabTo implementation of the Firefox

If the first argument is a tab, look up its index. Return the tab we get from insertBefore().
r=CTho, sr=Neil
This commit is contained in:
jag%tty.nl 2006-01-23 03:43:16 +00:00
parent e17e6bd51c
commit 34625e042e

View File

@ -1364,16 +1364,23 @@
<parameter name="aDestIndex"/>
<body>
<![CDATA[
// for compatibility with extensions
if (typeof(aSrcIndex) != "number")
aSrcIndex = this.getTabIndex(aSrcIndex);
this.mTabFilters.splice(aDestIndex, 0, this.mTabFilters.splice(aSrcIndex, 1)[0]);
this.mTabListeners.splice(aDestIndex, 0, this.mTabListeners.splice(aSrcIndex, 1)[0]);
aDestIndex = aDestIndex < aSrcIndex ? aDestIndex : aDestIndex + 1;
this.mCurrentTab.selected = false;
if (aDestIndex == this.mTabs.length)
this.mTabContainer.appendChild(this.mTabs[aSrcIndex]);
else
this.mTabContainer.insertBefore(this.mTabs[aSrcIndex], this.mTabs[aDestIndex]);
if (aDestIndex >= aSrcIndex)
++aDestIndex;
var tab = this.mTabContainer.insertBefore(this.mTabs[aSrcIndex],
this.mTabs[aDestIndex]);
this.mCurrentTab.selected = true;
return tab;
]]>
</body>
</method>