Cleanup needless (wrong) tab relations correctly (#605)
This commit is contained in:
parent
66734bbfaf
commit
ed6fafb2ec
@ -3804,8 +3804,10 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
|
|||||||
this.collapseExpandSubtree(aTab, isSubtreeCollapsed);
|
this.collapseExpandSubtree(aTab, isSubtreeCollapsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mayBeDuplicated)
|
if (mayBeDuplicated) {
|
||||||
this.clearRedirectionTableWithDelay();
|
this.clearRedirectionTableWithDelay();
|
||||||
|
this.clearRedirectbTabRelationsWithDelay(aTab);
|
||||||
|
}
|
||||||
|
|
||||||
delete aTab.__treestyletab__restoreState;
|
delete aTab.__treestyletab__restoreState;
|
||||||
},
|
},
|
||||||
@ -3925,12 +3927,10 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
|
|||||||
aTab.removeAttribute(this.kCHILDREN);
|
aTab.removeAttribute(this.kCHILDREN);
|
||||||
|
|
||||||
aChildrenList = aChildrenList.split('|');
|
aChildrenList = aChildrenList.split('|');
|
||||||
if (aMayBeDuplicated) {
|
if (aMayBeDuplicated)
|
||||||
aChildrenList = aChildrenList.map(function(aChild) {
|
aChildrenList = aChildrenList.map(function(aChild) {
|
||||||
return this.redirectId(aChild);
|
return this.redirectId(aChild);
|
||||||
}, this);
|
}, this);
|
||||||
this.clearRedirectbTabRelationsWithDelay(aTab);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0, maxi = aChildrenList.length; i < maxi; i++)
|
for (let i = 0, maxi = aChildrenList.length; i < maxi; i++)
|
||||||
{
|
{
|
||||||
@ -4131,13 +4131,14 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
|
|||||||
|
|
||||||
clearRedirectbTabRelationsWithDelay : function TSTBrowser_clearRedirectbTabRelationsWithDelay(aTab)
|
clearRedirectbTabRelationsWithDelay : function TSTBrowser_clearRedirectbTabRelationsWithDelay(aTab)
|
||||||
{
|
{
|
||||||
if (this._clearRedirectbTabRelationsTimer) {
|
if (aTab._clearRedirectbTabRelationsTimer) {
|
||||||
this.window.clearTimeout(this._clearRedirectbTabRelationsTimer);
|
this.window.clearTimeout(aTab._clearRedirectbTabRelationsTimer);
|
||||||
this._clearRedirectbTabRelationsTimer = null;
|
aTab._clearRedirectbTabRelationsTimer = null;
|
||||||
}
|
}
|
||||||
this._clearRedirectbTabRelationsTimer = this.window.setTimeout(function(aSelf) {
|
aTab._clearRedirectbTabRelationsTimer = this.window.setTimeout(function(aSelf) {
|
||||||
aSelf.clearRedirectbTabRelations(aTab);
|
aSelf.clearRedirectbTabRelations(aTab);
|
||||||
}, 1000, this);
|
delete aTab._clearRedirectbTabRelationsTimer;
|
||||||
|
}, 1500, this);
|
||||||
},
|
},
|
||||||
clearRedirectbTabRelations : function TSTBrowser_clearRedirectbTabRelations(aTab)
|
clearRedirectbTabRelations : function TSTBrowser_clearRedirectbTabRelations(aTab)
|
||||||
{
|
{
|
||||||
@ -4151,7 +4152,19 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
|
|||||||
return !!aId;
|
return !!aId;
|
||||||
});
|
});
|
||||||
|
|
||||||
var children = aTab.getAttribute(this.kCHILDREN);
|
var ancestors = this.getTabValue(aTab, this.kANCESTORS);
|
||||||
|
if (ancestors) {
|
||||||
|
ancestors = ancestors.split('|');
|
||||||
|
ancestors = ancestors.filter(function(aAncestor) {
|
||||||
|
return redirectedIds.indexOf(aAncestor) > -1;
|
||||||
|
}, this);
|
||||||
|
if (ancestors.length)
|
||||||
|
this.setTabValue(aTab, this.kANCESTORS, ancestors.join('|'));
|
||||||
|
else
|
||||||
|
this.deleteTabValue(aTab, this.kANCESTORS);
|
||||||
|
}
|
||||||
|
|
||||||
|
var children = this.getTabValue(aTab, this.kCHILDREN);
|
||||||
if (children) {
|
if (children) {
|
||||||
children = children.split('|');
|
children = children.split('|');
|
||||||
children = children.filter(function(aChild) {
|
children = children.filter(function(aChild) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user