add codes for failsafe
This commit is contained in:
parent
87c0b4ad27
commit
7d3f967b1a
@ -2290,9 +2290,14 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
var tabs = this.getAllTabsArray(this.mTabBrowser);
|
var tabs = this.getAllTabsArray(this.mTabBrowser);
|
||||||
tabs.reverse().forEach(function(aTab) {
|
tabs.reverse().forEach(function(aTab) {
|
||||||
var id = this.getTabValue(aTab, this.kID);
|
var id = this.getTabValue(aTab, this.kID);
|
||||||
if (!id)
|
if (
|
||||||
|
!id || // tabs opened by externals applications
|
||||||
|
aTab.hidden // tabs in background groups
|
||||||
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var alreadyRestored = id == aTab.getAttribute(this.kID);
|
||||||
|
|
||||||
aTab.setAttribute(this.kID, id);
|
aTab.setAttribute(this.kID, id);
|
||||||
this.tabsHash[id] = aTab;
|
this.tabsHash[id] = aTab;
|
||||||
|
|
||||||
@ -2304,15 +2309,16 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
if (aChild)
|
if (aChild)
|
||||||
this.attachTabTo(aChild, aTab, {
|
this.attachTabTo(aChild, aTab, {
|
||||||
forceExpand : true, // to prevent to collapse the selected tab
|
forceExpand : true, // to prevent to collapse the selected tab
|
||||||
dontAnimate : true
|
dontAnimate : true,
|
||||||
|
dontMove : true
|
||||||
});
|
});
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.collapseExpandSubtree(aTab, subTreeCollapsed, true);
|
this.collapseExpandSubtree(aTab, subTreeCollapsed, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updateInsertionPositionInfo(aTab);
|
this.updateInsertionPositionInfo(aTab);
|
||||||
|
|
||||||
|
if (!alreadyRestored)
|
||||||
aTab.__treestyletab__structureRestored = true;
|
aTab.__treestyletab__structureRestored = true;
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
@ -3205,7 +3211,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
aTab.getAttribute(this.kCHILDREN) != children
|
aTab.getAttribute(this.kCHILDREN) != children
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
// for safety
|
// failsafe
|
||||||
this.detachAllChildren(aTab, {
|
this.detachAllChildren(aTab, {
|
||||||
dontUpdateIndent : true,
|
dontUpdateIndent : true,
|
||||||
dontAnimate : this.windowService.restoringTree
|
dontAnimate : this.windowService.restoringTree
|
||||||
@ -3217,7 +3223,40 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
this.setTabValue(aTab, this.kID, id);
|
this.setTabValue(aTab, this.kID, id);
|
||||||
this.tabsHash[id] = aTab;
|
this.tabsHash[id] = aTab;
|
||||||
|
|
||||||
if (!structureRestored) {
|
if (structureRestored) {
|
||||||
|
/**
|
||||||
|
* By some reasons (ex. persistTabAttribute()), actual state of
|
||||||
|
* the tab (attributes) can be lost on SSTabRestoring.
|
||||||
|
* For failsafe, we must override actual attributes by stored
|
||||||
|
* values.
|
||||||
|
*/
|
||||||
|
[
|
||||||
|
this.kPARENT,
|
||||||
|
this.kINSERT_BEFORE,
|
||||||
|
this.kINSERT_AFTER
|
||||||
|
].forEach(function(aKey) {
|
||||||
|
var tab = this.getTabValue(aTab, aKey);
|
||||||
|
if (this.getTabById(tab))
|
||||||
|
this.setTabValue(aTab, aKey, tab);
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
let children = this.getTabValue(aTab, this.kCHILDREN);
|
||||||
|
if (children.split('|').every(function(aChild) {
|
||||||
|
return this.getTabById(aChild);
|
||||||
|
}, this))
|
||||||
|
this.setTabValue(aTab, this.kCHILDREN, children);
|
||||||
|
|
||||||
|
[
|
||||||
|
this.kSUBTREE_COLLAPSED,
|
||||||
|
this.kCOLLAPSED,
|
||||||
|
this.kCOLLAPSED_DONE
|
||||||
|
].forEach(function(aKey) {
|
||||||
|
var storedValue = this.getTabValue(aTab, aKey);
|
||||||
|
if (storedValue)
|
||||||
|
this.setTabValue(aTab, aKey, storedValue);
|
||||||
|
}, this);
|
||||||
|
}
|
||||||
|
else {
|
||||||
if (closeSetId)
|
if (closeSetId)
|
||||||
this.restoreClosedSet(closeSetId, aTab);
|
this.restoreClosedSet(closeSetId, aTab);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user