Bug 1169892 - Avoid extra round-trip when a pending tab is reloaded r=billm

This commit is contained in:
Tim Taubert 2015-05-30 10:13:52 +02:00
Родитель 1d622f38f2
Коммит cfc376cc2c
3 изменённых файлов: 9 добавлений и 19 удалений

Просмотреть файл

@ -136,7 +136,11 @@ ContentRestoreInternal.prototype = {
SessionHistory.restore(this.docShell, tabData);
// Add a listener to watch for reloads.
let listener = new HistoryListener(this.docShell, callbacks.onReload);
let listener = new HistoryListener(this.docShell, () => {
// On reload, restore tab contents.
this.restoreTabContent(null, callbacks.onLoadFinished);
});
webNavigation.sessionHistory.addSHistoryListener(listener);
this._historyListener = listener;

Просмотреть файл

@ -66,10 +66,6 @@ const MESSAGES = [
// SSTabRestored at this time.
"SessionStore:restoreTabContentComplete",
// A tab that is being restored was reloaded. We call restoreTabContent to
// finish restoring it right away.
"SessionStore:reloadPendingTab",
// A crashed tab was revived by navigating to a different page. Remove its
// browser from the list of crashed browsers to stop ignoring its messages.
"SessionStore:crashedTabRevived",
@ -769,11 +765,6 @@ let SessionStoreInternal = {
this._sendTabRestoredNotification(tab);
break;
case "SessionStore:reloadPendingTab":
if (browser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE) {
this.restoreTabContent(tab);
}
break;
case "SessionStore:crashedTabRevived":
this._crashedBrowsers.delete(browser.permanentKey);
break;

Просмотреть файл

@ -149,15 +149,10 @@ let MessageListener = {
restoreHistory({epoch, tabData, loadArguments}) {
gContentRestore.restoreHistory(tabData, loadArguments, {
onReload() {
// Inform SessionStore.jsm about the reload. It will send
// restoreTabContent in response.
sendAsyncMessage("SessionStore:reloadPendingTab", {epoch});
},
// Note: The two callbacks passed here will only be used when a load
// starts that was not initiated by sessionstore itself. This can happen
// when some code calls browser.loadURI() on a pending browser/tab.
// Note: The callbacks passed here will only be used when a load starts
// that was not initiated by sessionstore itself. This can happen when
// some code calls browser.loadURI() or browser.reload() on a pending
// browser/tab.
onLoadStarted() {
// Notify the parent that the tab is no longer pending.