Bug 684773 - Unpin all tabs earlier when restoring a session in overwriting mode; r=dietrich

This commit is contained in:
ithinc 2011-09-22 17:35:25 +01:00
Родитель 28beac255b
Коммит 205944c60f
1 изменённых файлов: 6 добавлений и 6 удалений

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

@ -2590,7 +2590,7 @@ SessionStoreService.prototype = {
(!winData.tabs[0].entries || winData.tabs[0].entries.length == 0)) {
winData.tabs = [];
}
var tabbrowser = aWindow.gBrowser;
var openTabCount = aOverwriteTabs ? tabbrowser.browsers.length : -1;
var newTabCount = winData.tabs.length;
@ -2600,11 +2600,6 @@ SessionStoreService.prototype = {
var tabstrip = tabbrowser.tabContainer.mTabstrip;
var smoothScroll = tabstrip.smoothScroll;
tabstrip.smoothScroll = false;
// make sure that the selected tab won't be closed in order to
// prevent unnecessary flickering
if (aOverwriteTabs && tabbrowser.selectedTab._tPos >= newTabCount)
tabbrowser.moveTabTo(tabbrowser.selectedTab, newTabCount - 1);
// unpin all tabs to ensure they are not reordered in the next loop
if (aOverwriteTabs) {
@ -2612,6 +2607,11 @@ SessionStoreService.prototype = {
tabbrowser.unpinTab(tabbrowser.tabs[t]);
}
// make sure that the selected tab won't be closed in order to
// prevent unnecessary flickering
if (aOverwriteTabs && tabbrowser.selectedTab._tPos >= newTabCount)
tabbrowser.moveTabTo(tabbrowser.selectedTab, newTabCount - 1);
for (var t = 0; t < newTabCount; t++) {
tabs.push(t < openTabCount ?
tabbrowser.tabs[t] :