forked from pool/MozillaFirefox
96 lines
4.2 KiB
Diff
96 lines
4.2 KiB
Diff
|
# HG changeset patch
|
||
|
# User Tim Taubert <ttaubert@mozilla.com>
|
||
|
# Date 1358185823 -3600
|
||
|
# Node ID f7a2af238d06c17d10c49c94ef860434d5b76758
|
||
|
Bug 712763 - Backout changes from bug 669272 to keep original window order when restoring a session
|
||
|
|
||
|
diff --git a/browser/components/sessionstore/src/SessionStore.jsm b/browser/components/sessionstore/src/SessionStore.jsm
|
||
|
--- a/browser/components/sessionstore/src/SessionStore.jsm
|
||
|
+++ b/browser/components/sessionstore/src/SessionStore.jsm
|
||
|
@@ -1757,23 +1757,16 @@ let SessionStoreInternal = {
|
||
|
|
||
|
// We want to re-use the last opened window instead of opening a new one in
|
||
|
// the case where it's "empty" and not associated with a window in the session.
|
||
|
// We will do more processing via _prepWindowToRestoreInto if we need to use
|
||
|
// the lastWindow.
|
||
|
let lastWindow = this._getMostRecentBrowserWindow();
|
||
|
let canUseLastWindow = lastWindow &&
|
||
|
!lastWindow.__SS_lastSessionWindowID;
|
||
|
- let lastSessionFocusedWindow = null;
|
||
|
- this.windowToFocus = lastWindow;
|
||
|
-
|
||
|
- // move the last focused window to the start of the array so that we
|
||
|
- // minimize window movement (see bug 669272)
|
||
|
- lastSessionState.windows.unshift(
|
||
|
- lastSessionState.windows.splice(lastSessionState.selectedWindow - 1, 1)[0]);
|
||
|
|
||
|
// Restore into windows or open new ones as needed.
|
||
|
for (let i = 0; i < lastSessionState.windows.length; i++) {
|
||
|
let winState = lastSessionState.windows[i];
|
||
|
let lastSessionWindowID = winState.__lastSessionWindowID;
|
||
|
// delete lastSessionWindowID so we don't add that to the window again
|
||
|
delete winState.__lastSessionWindowID;
|
||
|
|
||
|
@@ -1801,28 +1794,19 @@ let SessionStoreInternal = {
|
||
|
// Restore into that window - pretend it's a followup since we'll already
|
||
|
// have a focused window.
|
||
|
//XXXzpao This is going to merge extData together (taking what was in
|
||
|
// winState over what is in the window already. The hack we have
|
||
|
// in _preWindowToRestoreInto will prevent most (all?) Panorama
|
||
|
// weirdness but we will still merge other extData.
|
||
|
// Bug 588217 should make this go away by merging the group data.
|
||
|
this.restoreWindow(windowToUse, { windows: [winState] }, canOverwriteTabs, true);
|
||
|
- if (i == 0)
|
||
|
- lastSessionFocusedWindow = windowToUse;
|
||
|
-
|
||
|
- // if we overwrote the tabs for our last focused window, we should
|
||
|
- // give focus to the window that had it in the previous session
|
||
|
- if (canOverwriteTabs && windowToUse == lastWindow)
|
||
|
- this.windowToFocus = lastSessionFocusedWindow;
|
||
|
}
|
||
|
else {
|
||
|
- let win = this._openWindowWithState({ windows: [winState] });
|
||
|
- if (i == 0)
|
||
|
- lastSessionFocusedWindow = win;
|
||
|
+ this._openWindowWithState({ windows: [winState] });
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Merge closed windows from this session with ones from last session
|
||
|
if (lastSessionState._closedWindows) {
|
||
|
this._closedWindows = this._closedWindows.concat(lastSessionState._closedWindows);
|
||
|
this._capClosedWindows();
|
||
|
}
|
||
|
@@ -2735,27 +2719,27 @@ let SessionStoreInternal = {
|
||
|
this._setWindowStateBusy(aWindow);
|
||
|
|
||
|
if (root._closedWindows)
|
||
|
this._closedWindows = root._closedWindows;
|
||
|
|
||
|
var winData;
|
||
|
if (!root.selectedWindow || root.selectedWindow > root.windows.length) {
|
||
|
root.selectedWindow = 0;
|
||
|
- } else {
|
||
|
- // put the selected window at the beginning of the array to ensure that
|
||
|
- // it gets restored first
|
||
|
- root.windows.unshift(root.windows.splice(root.selectedWindow - 1, 1)[0]);
|
||
|
}
|
||
|
+
|
||
|
// open new windows for all further window entries of a multi-window session
|
||
|
// (unless they don't contain any tab data)
|
||
|
for (var w = 1; w < root.windows.length; w++) {
|
||
|
winData = root.windows[w];
|
||
|
if (winData && winData.tabs && winData.tabs[0]) {
|
||
|
var window = this._openWindowWithState({ windows: [winData] });
|
||
|
+ if (w == root.selectedWindow - 1) {
|
||
|
+ this.windowToFocus = window;
|
||
|
+ }
|
||
|
}
|
||
|
}
|
||
|
winData = root.windows[0];
|
||
|
if (!winData.tabs) {
|
||
|
winData.tabs = [];
|
||
|
}
|
||
|
// don't restore a single blank tab when we've had an external
|
||
|
// URL passed in for loading at startup (cf. bug 357419)
|