|
1 # HG changeset patch |
|
2 # User Tim Taubert <ttaubert@mozilla.com> |
|
3 # Date 1358185823 -3600 |
|
4 # Node ID f7a2af238d06c17d10c49c94ef860434d5b76758 |
|
5 Bug 712763 - Backout changes from bug 669272 to keep original window order when restoring a session |
|
6 |
|
7 diff --git a/browser/components/sessionstore/src/SessionStore.jsm b/browser/components/sessionstore/src/SessionStore.jsm |
|
8 --- a/browser/components/sessionstore/src/SessionStore.jsm |
|
9 +++ b/browser/components/sessionstore/src/SessionStore.jsm |
|
10 @@ -1757,23 +1757,16 @@ let SessionStoreInternal = { |
|
11 |
|
12 // We want to re-use the last opened window instead of opening a new one in |
|
13 // the case where it's "empty" and not associated with a window in the session. |
|
14 // We will do more processing via _prepWindowToRestoreInto if we need to use |
|
15 // the lastWindow. |
|
16 let lastWindow = this._getMostRecentBrowserWindow(); |
|
17 let canUseLastWindow = lastWindow && |
|
18 !lastWindow.__SS_lastSessionWindowID; |
|
19 - let lastSessionFocusedWindow = null; |
|
20 - this.windowToFocus = lastWindow; |
|
21 - |
|
22 - // move the last focused window to the start of the array so that we |
|
23 - // minimize window movement (see bug 669272) |
|
24 - lastSessionState.windows.unshift( |
|
25 - lastSessionState.windows.splice(lastSessionState.selectedWindow - 1, 1)[0]); |
|
26 |
|
27 // Restore into windows or open new ones as needed. |
|
28 for (let i = 0; i < lastSessionState.windows.length; i++) { |
|
29 let winState = lastSessionState.windows[i]; |
|
30 let lastSessionWindowID = winState.__lastSessionWindowID; |
|
31 // delete lastSessionWindowID so we don't add that to the window again |
|
32 delete winState.__lastSessionWindowID; |
|
33 |
|
34 @@ -1801,28 +1794,19 @@ let SessionStoreInternal = { |
|
35 // Restore into that window - pretend it's a followup since we'll already |
|
36 // have a focused window. |
|
37 //XXXzpao This is going to merge extData together (taking what was in |
|
38 // winState over what is in the window already. The hack we have |
|
39 // in _preWindowToRestoreInto will prevent most (all?) Panorama |
|
40 // weirdness but we will still merge other extData. |
|
41 // Bug 588217 should make this go away by merging the group data. |
|
42 this.restoreWindow(windowToUse, { windows: [winState] }, canOverwriteTabs, true); |
|
43 - if (i == 0) |
|
44 - lastSessionFocusedWindow = windowToUse; |
|
45 - |
|
46 - // if we overwrote the tabs for our last focused window, we should |
|
47 - // give focus to the window that had it in the previous session |
|
48 - if (canOverwriteTabs && windowToUse == lastWindow) |
|
49 - this.windowToFocus = lastSessionFocusedWindow; |
|
50 } |
|
51 else { |
|
52 - let win = this._openWindowWithState({ windows: [winState] }); |
|
53 - if (i == 0) |
|
54 - lastSessionFocusedWindow = win; |
|
55 + this._openWindowWithState({ windows: [winState] }); |
|
56 } |
|
57 } |
|
58 |
|
59 // Merge closed windows from this session with ones from last session |
|
60 if (lastSessionState._closedWindows) { |
|
61 this._closedWindows = this._closedWindows.concat(lastSessionState._closedWindows); |
|
62 this._capClosedWindows(); |
|
63 } |
|
64 @@ -2735,27 +2719,27 @@ let SessionStoreInternal = { |
|
65 this._setWindowStateBusy(aWindow); |
|
66 |
|
67 if (root._closedWindows) |
|
68 this._closedWindows = root._closedWindows; |
|
69 |
|
70 var winData; |
|
71 if (!root.selectedWindow || root.selectedWindow > root.windows.length) { |
|
72 root.selectedWindow = 0; |
|
73 - } else { |
|
74 - // put the selected window at the beginning of the array to ensure that |
|
75 - // it gets restored first |
|
76 - root.windows.unshift(root.windows.splice(root.selectedWindow - 1, 1)[0]); |
|
77 } |
|
78 + |
|
79 // open new windows for all further window entries of a multi-window session |
|
80 // (unless they don't contain any tab data) |
|
81 for (var w = 1; w < root.windows.length; w++) { |
|
82 winData = root.windows[w]; |
|
83 if (winData && winData.tabs && winData.tabs[0]) { |
|
84 var window = this._openWindowWithState({ windows: [winData] }); |
|
85 + if (w == root.selectedWindow - 1) { |
|
86 + this.windowToFocus = window; |
|
87 + } |
|
88 } |
|
89 } |
|
90 winData = root.windows[0]; |
|
91 if (!winData.tabs) { |
|
92 winData.tabs = []; |
|
93 } |
|
94 // don't restore a single blank tab when we've had an external |
|
95 // URL passed in for loading at startup (cf. bug 357419) |