Bug 982938 - [e10s] Update browser remoteness before restoring session (r=ttaubert)
authorBill McCloskey <wmccloskey@mozilla.com>
Thu, 24 Apr 2014 11:17:35 -0700
changeset 180438 ec9e918e47dd4c9af4cde8d9804267ead85939b3
parent 180437 75e0bec11afdce043a9d96d3e32bb6c8533b6dc7
child 180439 45f4f9b91b970ef9f67f5d3418e49749b41daafb
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersttaubert
bugs982938
milestone31.0a1
Bug 982938 - [e10s] Update browser remoteness before restoring session (r=ttaubert)
browser/components/sessionstore/src/SessionStore.jsm
--- a/browser/components/sessionstore/src/SessionStore.jsm
+++ b/browser/components/sessionstore/src/SessionStore.jsm
@@ -2576,16 +2576,22 @@ let SessionStoreInternal = {
       // Ensure the index is in bounds.
       let activeIndex = (tabData.index || tabData.entries.length) - 1;
       activeIndex = Math.min(activeIndex, tabData.entries.length - 1);
       activeIndex = Math.max(activeIndex, 0);
 
       // Save the index in case we updated it above.
       tabData.index = activeIndex + 1;
 
+      // In electrolysis, we may need to change the browser's remote
+      // attribute so that it runs in a content process.
+      let activePageData = tabData.entries[activeIndex] || null;
+      let uri = activePageData ? activePageData.url || null : null;
+      tabbrowser.updateBrowserRemoteness(browser, uri);
+
       // Start a new epoch and include the epoch in the restoreHistory
       // message. If a message is received that relates to a previous epoch, we
       // discard it.
       let epoch = this._nextRestoreEpoch++;
       this._browserEpochs.set(browser.permanentKey, epoch);
 
       // keep the data around to prevent dataloss in case
       // a tab gets closed before it's been properly restored
@@ -2599,22 +2605,16 @@ let SessionStoreInternal = {
         history: {entries: tabData.entries, index: tabData.index},
         scroll: tabData.scroll || null,
         storage: tabData.storage || null,
         formdata: tabData.formdata || null,
         disallow: tabData.disallow || null,
         pageStyle: tabData.pageStyle || null
       });
 
-      // In electrolysis, we may need to change the browser's remote
-      // attribute so that it runs in a content process.
-      let activePageData = tabData.entries[activeIndex] || null;
-      let uri = activePageData ? activePageData.url || null : null;
-      tabbrowser.updateBrowserRemoteness(browser, uri);
-
       browser.messageManager.sendAsyncMessage("SessionStore:restoreHistory",
                                               {tabData: tabData, epoch: epoch});
 
       // Restore tab attributes.
       if ("attributes" in tabData) {
         TabAttributes.set(tab, tabData.attributes);
       }