Bug 1096013 - Give selected tabs highest priority during restoration. r?mikedeboer
MozReview-Commit-ID: EtApFsDyB50
--- a/browser/components/sessionstore/SessionStore.jsm
+++ b/browser/components/sessionstore/SessionStore.jsm
@@ -3487,19 +3487,27 @@ var SessionStoreInternal = {
// If provided, set the selected tab.
if (aSelectTab > 0 && aSelectTab <= aTabs.length) {
tabbrowser.selectedTab = aTabs[aSelectTab - 1];
// Update the window state in case we shut down without being notified.
this._windows[aWindow.__SSi].selected = aSelectTab;
}
+ // If we restore the selected tab, make sure it goes first.
+ let selectedIndex = aTabs.indexOf(tabbrowser.selectedTab);
+ if (selectedIndex > -1) {
+ this.restoreTab(tabbrowser.selectedTab, aTabData[selectedIndex]);
+ }
+
// Restore all tabs.
for (let t = 0; t < aTabs.length; t++) {
- this.restoreTab(aTabs[t], aTabData[t]);
+ if (t != selectedIndex) {
+ this.restoreTab(aTabs[t], aTabData[t]);
+ }
}
},
// Restores the given tab state for a given tab.
restoreTab(tab, tabData, options = {}) {
NS_ASSERT(!tab.linkedBrowser.__SS_restoreState,
"must reset tab before calling restoreTab()");