Bug 639843 - Port Bug 628270 [Undo close (hidden) tab causes panorama and session restore to break unrecoverably]. r=Neil

This commit is contained in:
Misak Khachatryan 2011-03-18 18:34:34 +04:00
Родитель 93c05eaf88
Коммит f1f1daf0d9
1 изменённых файлов: 21 добавлений и 14 удалений

Просмотреть файл

@ -2300,7 +2300,21 @@ SessionStoreService.prototype = {
} }
} }
if (aTabs.length > 0) { if (!this._isWindowLoaded(aWindow)) {
// from now on, the data will come from the actual window
delete this._statesToRestore[aWindow.__SS_restoreID];
delete aWindow.__SS_restoreID;
delete this._windows[aWindow.__SSi]._restoring;
}
if (aTabs.length == 0) {
// this is normally done in restoreHistory() but as we're returning early
// here we need to take care of it.
this._sendWindowStateEvent(aWindow, "Ready");
return;
}
if (aTabs.length > 1) {
// Load hidden tabs last, by pushing them to the end of the list // Load hidden tabs last, by pushing them to the end of the list
let unhiddenTabs = aTabs.length; let unhiddenTabs = aTabs.length;
for (let t = 0; t < unhiddenTabs; ) { for (let t = 0; t < unhiddenTabs; ) {
@ -2333,13 +2347,13 @@ SessionStoreService.prototype = {
aTabData = aTabData.splice(firstVisibleTab, maxVisibleTabs).concat(aTabData); aTabData = aTabData.splice(firstVisibleTab, maxVisibleTabs).concat(aTabData);
aSelectTab -= firstVisibleTab; aSelectTab -= firstVisibleTab;
} }
}
// make sure to restore the selected tab first (if any) // make sure to restore the selected tab first (if any)
if (aSelectTab-- && aTabs[aSelectTab]) { if (aSelectTab-- && aTabs[aSelectTab]) {
aTabs.unshift(aTabs.splice(aSelectTab, 1)[0]); aTabs.unshift(aTabs.splice(aSelectTab, 1)[0]);
aTabData.unshift(aTabData.splice(aSelectTab, 1)[0]); aTabData.unshift(aTabData.splice(aSelectTab, 1)[0]);
tabbrowser.selectedTab = aTabs[0]; tabbrowser.selectedTab = aTabs[0];
}
} }
// Prepare the tabs so that they can be properly restored. We'll pin/unpin // Prepare the tabs so that they can be properly restored. We'll pin/unpin
@ -2391,13 +2405,6 @@ SessionStoreService.prototype = {
} }
} }
if (!this._isWindowLoaded(aWindow)) {
// from now on, the data will come from the actual window
delete this._statesToRestore[aWindow.__SS_restoreID];
delete aWindow.__SS_restoreID;
delete this._windows[aWindow.__SSi]._restoring;
}
// helper hashes for ensuring unique frame IDs and unique document // helper hashes for ensuring unique frame IDs and unique document
// identifiers. // identifiers.
var idMap = { used: {} }; var idMap = { used: {} };