Restore tree structure with multiple trees from bookmarks correctly, even if the dummy tab is disabled. (#662)

This commit is contained in:
YUKI Hiroshi 2014-09-30 19:59:15 +09:00
parent 5e498bd0ac
commit c595c8ba22

View File

@ -395,6 +395,10 @@ var TreeStyleTabBookmarksService = inherit(TreeStyleTabService, {
null : null :
sv.getTreeStructureFromItems(aIDs) ; sv.getTreeStructureFromItems(aIDs) ;
if (treeStructure) { if (treeStructure) {
let parentTabs = treeStructure.filter(function(aParent) {
return aParent < 0;
});
let haveMultipleTrees = parentTabs.length != treeStructure.length;
if (result.behavior & sv.kGROUP_BOOKMARK_USE_DUMMY) { if (result.behavior & sv.kGROUP_BOOKMARK_USE_DUMMY) {
let parentCount = 0; let parentCount = 0;
let childCount = 0; let childCount = 0;
@ -420,7 +424,7 @@ var TreeStyleTabBookmarksService = inherit(TreeStyleTabService, {
})); }));
} }
} }
else { else if (!haveMultipleTrees) {
// make the first item parent. // make the first item parent.
treeStructure = treeStructure.map(function(aParent, aIndex) { treeStructure = treeStructure.map(function(aParent, aIndex) {
if (aIndex == 0) if (aIndex == 0)