From 205944c60f84349747609a610cabdeae67bd37b2 Mon Sep 17 00:00:00 2001 From: ithinc Date: Thu, 22 Sep 2011 17:35:25 +0100 Subject: [PATCH] Bug 684773 - Unpin all tabs earlier when restoring a session in overwriting mode; r=dietrich --- .../components/sessionstore/src/nsSessionStore.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/browser/components/sessionstore/src/nsSessionStore.js b/browser/components/sessionstore/src/nsSessionStore.js index 8adf9d703bca..3472745218cc 100644 --- a/browser/components/sessionstore/src/nsSessionStore.js +++ b/browser/components/sessionstore/src/nsSessionStore.js @@ -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] :