_reserveCloseNeedlessGroupTabParent() should receive the closing tab instead of the parent tab.

Because another similar method _reserveCloseNeedlessGroupTabSibling() receives the closing tab.
This commit is contained in:
Piro / YUKI Hiroshi 2013-05-06 05:15:55 +09:00
parent 895b038fe7
commit eedc895e22

View File

@ -2937,7 +2937,6 @@ TreeStyleTabBrowser.prototype = {
var firstChild = this.getFirstChildTab(tab); var firstChild = this.getFirstChildTab(tab);
if (firstChild) { if (firstChild) {
let children = this.getChildTabs(tab); let children = this.getChildTabs(tab);
if (closeParentBehavior == this.kCLOSE_PARENT_BEHAVIOR_PROMOTE_FIRST_CHILD) if (closeParentBehavior == this.kCLOSE_PARENT_BEHAVIOR_PROMOTE_FIRST_CHILD)
this.updateTabsIndentWithDelay(children.slice(0, 1)); this.updateTabsIndentWithDelay(children.slice(0, 1));
else else
@ -2962,7 +2961,7 @@ TreeStyleTabBrowser.prototype = {
nextFocusedTab = this.getPreviousSiblingTab(tab); nextFocusedTab = this.getPreviousSiblingTab(tab);
} }
let toBeClosedParent = this._reserveCloseNeedlessGroupTabParent(parentTab); let toBeClosedParent = this._reserveCloseNeedlessGroupTabParent(tab);
if (toBeClosedParent && nextFocusedTab == toBeClosedParent) if (toBeClosedParent && nextFocusedTab == toBeClosedParent)
nextFocusedTab = this.getNextFocusedTab(parentTab); nextFocusedTab = this.getNextFocusedTab(parentTab);
} }
@ -3070,22 +3069,30 @@ TreeStyleTabBrowser.prototype = {
return null; return null;
}, },
_reserveCloseNeedlessGroupTabParent : function TSTBrowser_reserveCloseNeedlessGroupTabParent(aParentTab) _reserveCloseNeedlessGroupTabParent : function TSTBrowser_reserveCloseNeedlessGroupTabParent(aTab)
{ {
if (!aTab)
return null;
var parentTab = this.getParentTab(aTab);
if (!parentTab)
return null;
var shouldCloseParentTab = ( var shouldCloseParentTab = (
this.isGroupTab(aParentTab) && this.isGroupTab(parentTab) &&
this.getDescendantTabs(aParentTab).length == 1 this.getDescendantTabs(parentTab).length == 1
); );
if (shouldCloseParentTab) { if (shouldCloseParentTab) {
let key = 'onTabClose_'+parseInt(Math.random() * 65000); let key = 'onTabClose_'+parseInt(Math.random() * 65000);
let self = this; let self = this;
(this.deferredTasks[key] = this.Deferred.next(function() { (this.deferredTasks[key] = this.Deferred.next(function() {
if (aParentTab.parentNode) if (parentTab.parentNode)
self.mTabBrowser.removeTab(aParentTab, { animate : true }); self.mTabBrowser.removeTab(parentTab, { animate : true });
aParentTab = null;
})).error(this.defaultDeferredErrorHandler).next(function() { })).error(this.defaultDeferredErrorHandler).next(function() {
delete self.deferredTasks[key]; delete self.deferredTasks[key];
}).next(function() { }).next(function() {
parentTab = null;
aTab = null;
self = null; self = null;
key = null; key = null;
}); });