Bug 1348613 - Only use sync message for SessionStore:restoreHistoryComplete for non-remote tabs. r?mikedeboer
MozReview-Commit-ID: IuOtKpudDTU
--- 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,