Bug 829568 - part 1 - don't save (invalid) states without any windows; r=felipe
authorTim Taubert <tim.taubert@gmx.de>
Fri, 15 Feb 2013 12:28:00 +0100
changeset 122278 a919f0c65b692a23cf65859eb7ecd55cba9eae4c
parent 122277 300311c8e0eb169e1f2a44c0881e299805c76f4c
child 122279 bcc9c69de523523be6b9ab860506072430ba3c8e
push id24328
push userttaubert@mozilla.com
push dateTue, 19 Feb 2013 09:39:45 +0000
treeherdermozilla-central@3f0f2fc4bd0f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfelipe
bugs829568
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 829568 - part 1 - don't save (invalid) states without any windows; r=felipe
browser/components/sessionstore/src/SessionStore.jsm
--- a/browser/components/sessionstore/src/SessionStore.jsm
+++ b/browser/components/sessionstore/src/SessionStore.jsm
@@ -3626,16 +3626,25 @@ let SessionStoreInternal = {
     for (let i = oState.windows.length - 1; i >= 0; i--) {
       if (oState.windows[i].isPrivate) {
         oState.windows.splice(i, 1);
         if (oState.selectedWindow >= i) {
           oState.selectedWindow--;
         }
       }
     }
+
+    // Don't save invalid states.
+    // Looks we currently have private windows, only.
+    if (oState.windows.length == 0) {
+      TelemetryStopwatch.cancel("FX_SESSION_RESTORE_COLLECT_DATA_MS");
+      TelemetryStopwatch.cancel("FX_SESSION_RESTORE_COLLECT_DATA_LONGEST_OP_MS");
+      return;
+    }
+
     for (let i = oState._closedWindows.length - 1; i >= 0; i--) {
       if (oState._closedWindows[i].isPrivate) {
         oState._closedWindows.splice(i, 1);
       }
     }
 
 #ifndef XP_MACOSX
     // We want to restore closed windows that are marked with _shouldRestore.