Bug 1167508 - Cancel pending actions when after flushing the window is gone r=billm
☠☠ backed out by 986f641d87e4 ☠ ☠
authorTim Taubert <ttaubert@mozilla.com>
Wed, 03 Jun 2015 17:59:50 +0200
changeset 248034 5080433ff6105dcd9b2280319a99406c349af245
parent 248033 97b5372b89506a986eb23f13e91e2ded2ac4e87d
child 248035 01a6f68c4e53ed187a4bb059a48b324d2260ee50
push id60888
push userkwierso@gmail.com
push dateThu, 11 Jun 2015 01:38:38 +0000
treeherdermozilla-inbound@39e638ed06bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs1167508
milestone41.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 1167508 - Cancel pending actions when after flushing the window is gone r=billm
browser/components/sessionstore/SessionStore.jsm
--- a/browser/components/sessionstore/SessionStore.jsm
+++ b/browser/components/sessionstore/SessionStore.jsm
@@ -1809,16 +1809,23 @@ let SessionStoreInternal = {
     // Flush to get the latest tab state to duplicate.
     let browser = aTab.linkedBrowser;
     TabStateFlusher.flush(browser).then(() => {
       // The new tab might have been closed in the meantime.
       if (newTab.closing || !newTab.linkedBrowser) {
         return;
       }
 
+      let window = newTab.ownerDocument && newTab.ownerDocument.defaultView;
+
+      // The tab or its window might be gone.
+      if (!window || !window.__SSi) {
+        return;
+      }
+
       // Update state with flushed data. We can't use TabState.clone() here as
       // the tab to duplicate may have already been closed. In that case we
       // only have access to the <xul:browser>.
       let options = {includePrivateData: true};
       TabState.copyFromCache(browser, tabState, options);
 
       tabState.index += aDelta;
       tabState.index = Math.max(1, Math.min(tabState.index, tabState.entries.length));
@@ -2176,17 +2183,24 @@ let SessionStoreInternal = {
     // Set tab title to "Connecting..." and start the throbber to pretend we're
     // doing something while actually waiting for data from the frame script.
     window.gBrowser.setTabTitleLoading(tab);
     tab.setAttribute("busy", "true");
 
     // Flush to get the latest tab state.
     TabStateFlusher.flush(browser).then(() => {
       // The tab might have been closed/gone in the meantime.
-      if (tab.closing || !tab.linkedBrowser || !tab.ownerDocument.defaultView) {
+      if (tab.closing || !tab.linkedBrowser) {
+        return;
+      }
+
+      let window = tab.ownerDocument && tab.ownerDocument.defaultView;
+
+      // The tab or its window might be gone.
+      if (!window || !window.__SSi) {
         return;
       }
 
       let tabState = TabState.clone(tab);
       let options = {restoreImmediately: true};
 
       if (historyIndex >= 0) {
         tabState.index = historyIndex + 1;