Bug 712763 - Backout changes from bug 669272 to keep original window order when restoring a session firefox19
authorWolfgang Rosenauer <wr@rosenauer.org>
Mon, 18 Feb 2013 14:11:20 +0100
branchfirefox19
changeset 616 f46af22f1079
parent 615 fb49ee6e3828
child 619 666cf9899b82
Bug 712763 - Backout changes from bug 669272 to keep original window order when restoring a session
MozillaFirefox/MozillaFirefox.changes
MozillaFirefox/MozillaFirefox.spec
MozillaFirefox/firefox-712763.patch
firefox-712763.patch
series
--- a/MozillaFirefox/MozillaFirefox.changes	Sat Feb 16 18:30:31 2013 +0100
+++ b/MozillaFirefox/MozillaFirefox.changes	Mon Feb 18 14:11:20 2013 +0100
@@ -5,6 +5,7 @@
   * removed obsolete patches
     - mozilla-webrtc.patch
     - mozilla-gstreamer-803287.patch
+- added patch to fix session restore window order (bmo#712763)
 
 -------------------------------------------------------------------
 Sat Feb  2 08:40:52 UTC 2013 - wr@rosenauer.org
--- a/MozillaFirefox/MozillaFirefox.spec	Sat Feb 16 18:30:31 2013 +0100
+++ b/MozillaFirefox/MozillaFirefox.spec	Mon Feb 18 14:11:20 2013 +0100
@@ -106,6 +106,7 @@
 Patch33:        firefox-no-default-ualocale.patch
 Patch34:        firefox-multilocale-chrome.patch
 Patch35:        firefox-branded-icons.patch
+Patch36:        firefox-712763.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Requires(post):   coreutils shared-mime-info desktop-file-utils
 Requires(postun): shared-mime-info desktop-file-utils
@@ -244,6 +245,7 @@
 %patch33 -p1
 %patch34 -p1
 %patch35 -p1
+%patch36 -p1
 
 %build
 # no need to add build time to binaries
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MozillaFirefox/firefox-712763.patch	Mon Feb 18 14:11:20 2013 +0100
@@ -0,0 +1,1 @@
+../firefox-712763.patch
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/firefox-712763.patch	Mon Feb 18 14:11:20 2013 +0100
@@ -0,0 +1,95 @@
+# 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)
--- a/series	Sat Feb 16 18:30:31 2013 +0100
+++ b/series	Mon Feb 18 14:11:20 2013 +0100
@@ -29,3 +29,4 @@
 firefox-no-default-ualocale.patch
 firefox-multilocale-chrome.patch
 firefox-branded-icons.patch
+firefox-712763.patch