mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-14 12:13:22 +00:00
Bug 688695 - Deferred session restore doesn't behave correctly for a single tab group; r=zpao
This commit is contained in:
parent
ab9ba2ebdd
commit
475c879b48
@ -1646,26 +1646,14 @@ SessionStoreService.prototype = {
|
||||
// Inspect extData for Panorama identifiers. If found, then we want to
|
||||
// inspect further. If there is a single group, then we can use this
|
||||
// window. If there are multiple groups then we won't use this window.
|
||||
let data = this.getWindowValue(aWindow, "tabview-group");
|
||||
if (data) {
|
||||
data = JSON.parse(data);
|
||||
let groupsData = this.getWindowValue(aWindow, "tabview-groups");
|
||||
if (groupsData) {
|
||||
groupsData = JSON.parse(groupsData);
|
||||
|
||||
// Multiple keys means multiple groups, which means we don't want to use this window.
|
||||
if (Object.keys(data).length > 1) {
|
||||
// If there are multiple groups, we don't want to use this window.
|
||||
if (groupsData.totalNumber > 1)
|
||||
return [false, false];
|
||||
}
|
||||
else {
|
||||
// If there is only one group, then we want to ensure that its group id
|
||||
// is 0. This is how Panorama forces group merging when new tabs are opened.
|
||||
//XXXzpao This is a hack and the proper fix really belongs in Panorama.
|
||||
let groupKey = Object.keys(data)[0];
|
||||
if (groupKey !== "0") {
|
||||
data["0"] = data[groupKey];
|
||||
delete data[groupKey];
|
||||
this.setWindowValue(aWindow, "tabview-groups", JSON.stringify(data));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Step 2 of processing:
|
||||
// If we're still here, then the window is usable. Look at the open tabs in
|
||||
|
@ -2233,12 +2233,26 @@ let GroupItems = {
|
||||
// All remaining children in to-be-closed groups are re-used by
|
||||
// session restore. Reconnect them so that they're put into their
|
||||
// right groups.
|
||||
groupItem.getChildren().forEach(function (tabItem) {
|
||||
let children = groupItem.getChildren().concat();
|
||||
|
||||
children.forEach(function (tabItem) {
|
||||
if (tabItem.parent && tabItem.parent.hidden)
|
||||
iQ(tabItem.container).show();
|
||||
|
||||
// sanity check the tab's groupID
|
||||
let tabData = Storage.getTabData(tabItem.tab);
|
||||
let parentGroup = GroupItems.groupItem(tabData.groupID);
|
||||
|
||||
// correct the tab's groupID if necessary
|
||||
if (!parentGroup || -1 < toClose.indexOf(parentGroup)) {
|
||||
tabData.groupID = activeGroupId || Object.keys(groupItemData)[0];
|
||||
Storage.saveTab(tabItem.tab, tabData);
|
||||
}
|
||||
|
||||
tabItem._reconnected = false;
|
||||
tabItem._reconnect();
|
||||
});
|
||||
|
||||
groupItem.close({immediately: true});
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user