Bug 1348613 - Only use sync message for SessionStore:restoreHistoryComplete for non-remote tabs. r?mikedeboer draft
authorMike Conley <mconley@mozilla.com>
Mon, 27 Mar 2017 12:56:38 -0400
changeset 551927 d668373436289965bbd9c2fbbe7413257277cb83
parent 551926 acd1c6ae9fb6b1380b9dc737240a803da8dfb105
child 621680 2f62980543061e623309566dba31febd3298a9f3
push id51200
push usermconley@mozilla.com
push dateMon, 27 Mar 2017 18:15:34 +0000
reviewersmikedeboer
bugs1348613
milestone55.0a1
Bug 1348613 - Only use sync message for SessionStore:restoreHistoryComplete for non-remote tabs. r?mikedeboer MozReview-Commit-ID: IuOtKpudDTU
browser/components/sessionstore/content/content-sessionStore.js
--- a/browser/components/sessionstore/content/content-sessionStore.js
+++ b/browser/components/sessionstore/content/content-sessionStore.js
@@ -184,23 +184,31 @@ var MessageListener = {
 
       onLoadFinished() {
         // Tell SessionStore.jsm that it may want to restore some more tabs,
         // since it restores a max of MAX_CONCURRENT_TAB_RESTORES at a time.
         sendAsyncMessage("SessionStore:restoreTabContentComplete", {epoch});
       }
     });
 
-    // When restoreHistory finishes, we send a synchronous message to
-    // SessionStore.jsm so that it can run SSTabRestoring. Users of
-    // SSTabRestoring seem to get confused if chrome and content are out of
-    // sync about the state of the restore (particularly regarding
-    // docShell.currentURI). Using a synchronous message is the easiest way
-    // to temporarily synchronize them.
-    sendSyncMessage("SessionStore:restoreHistoryComplete", {epoch, isRemotenessUpdate});
+    if (Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_DEFAULT) {
+      // For non-remote tabs, when restoreHistory finishes, we send a synchronous
+      // message to SessionStore.jsm so that it can run SSTabRestoring. Users of
+      // SSTabRestoring seem to get confused if chrome and content are out of
+      // sync about the state of the restore (particularly regarding
+      // docShell.currentURI). Using a synchronous message is the easiest way
+      // to temporarily synchronize them.
+      //
+      // For remote tabs, because all nsIWebProgress notifications are sent
+      // asynchronously using messages, we get the same-order guarantees of the
+      // message manager, and can use an async message.
+      sendSyncMessage("SessionStore:restoreHistoryComplete", {epoch, isRemotenessUpdate});
+    } else {
+      sendAsyncMessage("SessionStore:restoreHistoryComplete", {epoch, isRemotenessUpdate});
+    }
   },
 
   restoreTabContent({loadArguments, isRemotenessUpdate, reason}) {
     let epoch = gCurrentEpoch;
 
     // We need to pass the value of didStartLoad back to SessionStore.jsm.
     let didStartLoad = gContentRestore.restoreTabContent(loadArguments, isRemotenessUpdate, () => {
       // Tell SessionStore.jsm that it may want to restore some more tabs,