Bug 929097 - Check window type in SessionStore.onOpen() to ignore; r=smacleod
authorTim Taubert <ttaubert@mozilla.com>
Tue, 22 Oct 2013 00:21:20 +0200
changeset 166322 cc1740f2a675b3bdc87605d30b1f2fce0584ba37
parent 166321 88c45f057f1e4c0699d12cb413a377b9266fd325
child 166323 83562506fa87d73ead8c8064c5a301872764140f
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmacleod
bugs929097
milestone27.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 929097 - Check window type in SessionStore.onOpen() to ignore; r=smacleod
browser/components/sessionstore/src/SessionStore.jsm
--- a/browser/components/sessionstore/src/SessionStore.jsm
+++ b/browser/components/sessionstore/src/SessionStore.jsm
@@ -687,19 +687,18 @@ let SessionStoreInternal = {
    * @param aInitialState
    *        The initial state to be loaded after startup (optional)
    */
   onLoad: function ssi_onLoad(aWindow, aInitialState = null) {
     // return if window has already been initialized
     if (aWindow && aWindow.__SSi && this._windows[aWindow.__SSi])
       return;
 
-    // ignore non-browser windows and windows opened while shutting down
-    if (aWindow.document.documentElement.getAttribute("windowtype") != "navigator:browser" ||
-        this._loadState == STATE_QUITTING)
+    // ignore windows opened while shutting down
+    if (this._loadState == STATE_QUITTING)
       return;
 
     // Assign the window a unique identifier we can use to reference
     // internal data about the window.
     aWindow.__SSi = this._generateWindowID();
 
     // and create its data object
     this._windows[aWindow.__SSi] = { tabs: [], selected: 0, _closedTabs: [], busy: false };
@@ -854,16 +853,23 @@ let SessionStoreInternal = {
    * On window open
    * @param aWindow
    *        Window reference
    */
   onOpen: function ssi_onOpen(aWindow) {
     let onload = () => {
       aWindow.removeEventListener("load", onload);
 
+      let windowType = aWindow.document.documentElement.getAttribute("windowtype");
+
+      // Ignore non-browser windows.
+      if (windowType != "navigator:browser") {
+        return;
+      }
+
       if (this._sessionInitialized) {
         this.onLoad(aWindow);
         return;
       }
 
       // We can't call this.onLoad since initialization
       // hasn't completed, so we'll wait until it is done.
       // Even if additional windows are opened and wait