Bug 1522839 - Cache permanentKey in case it changes during navigateAndRestore. r=qdot a=lizzard
authorNika Layzell <nika@thelayzells.com>
Tue, 12 Feb 2019 02:47:51 +0000
changeset 513048 a5083352550a
parent 513047 401c1404f3b0
child 513049 2af591523036
push id10697
push usernbeleuzu@mozilla.com
push dateThu, 14 Feb 2019 01:25:42 +0000
treeherdermozilla-beta@f47db91d62e1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersqdot, lizzard
bugs1522839
milestone66.0
Bug 1522839 - Cache permanentKey in case it changes during navigateAndRestore. r=qdot a=lizzard Differential Revision: https://phabricator.services.mozilla.com/D19402
browser/components/sessionstore/SessionStore.jsm
--- a/browser/components/sessionstore/SessionStore.jsm
+++ b/browser/components/sessionstore/SessionStore.jsm
@@ -3180,27 +3180,28 @@ var SessionStoreInternal = {
    * trigger a remoteness changing load with the most recent load arguments.
    *
    * This method's promise will resolve when the process for the given
    * xul:browser element has successfully been swapped.
    *
    * @param tab to navigate and restore.
    */
   async _asyncNavigateAndRestore(tab) {
-    let initialBrowser = tab.linkedBrowser;
+    let permanentKey = tab.linkedBrowser.permanentKey;
+
     // NOTE: This is currently the only async operation used, but this is likely
     // to change in the future.
-    await TabStateFlusher.flush(initialBrowser);
+    await TabStateFlusher.flush(tab.linkedBrowser);
 
     // Now that we have flushed state, our loadArguments, etc. may have been
     // overwritten by multiple calls to navigateAndRestore. Load the most
     // recently stored one.
     let {loadArguments, historyIndex} =
-      this._remotenessChangingBrowsers.get(initialBrowser.permanentKey);
-    this._remotenessChangingBrowsers.delete(initialBrowser.permanentKey);
+      this._remotenessChangingBrowsers.get(permanentKey);
+    this._remotenessChangingBrowsers.delete(permanentKey);
 
     // The tab might have been closed/gone in the meantime.
     if (tab.closing || !tab.linkedBrowser) {
       return;
     }
 
     // The tab or its window might be gone.
     let window = tab.ownerGlobal;