зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1169892 - Avoid extra round-trip when a pending tab is reloaded r=billm
This commit is contained in:
Родитель
1d622f38f2
Коммит
cfc376cc2c
|
@ -136,7 +136,11 @@ ContentRestoreInternal.prototype = {
|
||||||
SessionHistory.restore(this.docShell, tabData);
|
SessionHistory.restore(this.docShell, tabData);
|
||||||
|
|
||||||
// Add a listener to watch for reloads.
|
// 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);
|
webNavigation.sessionHistory.addSHistoryListener(listener);
|
||||||
this._historyListener = listener;
|
this._historyListener = listener;
|
||||||
|
|
||||||
|
|
|
@ -66,10 +66,6 @@ const MESSAGES = [
|
||||||
// SSTabRestored at this time.
|
// SSTabRestored at this time.
|
||||||
"SessionStore:restoreTabContentComplete",
|
"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
|
// 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.
|
// browser from the list of crashed browsers to stop ignoring its messages.
|
||||||
"SessionStore:crashedTabRevived",
|
"SessionStore:crashedTabRevived",
|
||||||
|
@ -769,11 +765,6 @@ let SessionStoreInternal = {
|
||||||
|
|
||||||
this._sendTabRestoredNotification(tab);
|
this._sendTabRestoredNotification(tab);
|
||||||
break;
|
break;
|
||||||
case "SessionStore:reloadPendingTab":
|
|
||||||
if (browser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE) {
|
|
||||||
this.restoreTabContent(tab);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "SessionStore:crashedTabRevived":
|
case "SessionStore:crashedTabRevived":
|
||||||
this._crashedBrowsers.delete(browser.permanentKey);
|
this._crashedBrowsers.delete(browser.permanentKey);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -149,15 +149,10 @@ let MessageListener = {
|
||||||
|
|
||||||
restoreHistory({epoch, tabData, loadArguments}) {
|
restoreHistory({epoch, tabData, loadArguments}) {
|
||||||
gContentRestore.restoreHistory(tabData, loadArguments, {
|
gContentRestore.restoreHistory(tabData, loadArguments, {
|
||||||
onReload() {
|
// Note: The callbacks passed here will only be used when a load starts
|
||||||
// Inform SessionStore.jsm about the reload. It will send
|
// that was not initiated by sessionstore itself. This can happen when
|
||||||
// restoreTabContent in response.
|
// some code calls browser.loadURI() or browser.reload() on a pending
|
||||||
sendAsyncMessage("SessionStore:reloadPendingTab", {epoch});
|
// browser/tab.
|
||||||
},
|
|
||||||
|
|
||||||
// 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.
|
|
||||||
|
|
||||||
onLoadStarted() {
|
onLoadStarted() {
|
||||||
// Notify the parent that the tab is no longer pending.
|
// Notify the parent that the tab is no longer pending.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче