зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1065785 - [e10s] Use session restore to reload crashed tabs. r=smacleod.
--HG-- extra : rebase_source : efbee6049f26f2e279dbe501b5af73004d9807c7
This commit is contained in:
Родитель
eefe7bf38d
Коммит
bc8641c1c5
|
@ -2576,8 +2576,8 @@ let BrowserOnClick = {
|
|||
TabCrashReporter.submitCrashReport(browser);
|
||||
}
|
||||
#endif
|
||||
|
||||
TabCrashReporter.reloadCrashedTab(browser);
|
||||
let tab = gBrowser.getTabForBrowser(browser);
|
||||
SessionStore.reviveCrashedTab(tab);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -276,6 +276,10 @@ this.SessionStore = {
|
|||
return SessionStoreInternal.getCurrentState(aUpdateAll);
|
||||
},
|
||||
|
||||
reviveCrashedTab(aTab) {
|
||||
return SessionStoreInternal.reviveCrashedTab(aTab);
|
||||
},
|
||||
|
||||
/**
|
||||
* Backstage pass to implementation details, used for testing purpose.
|
||||
* Controlled by preference "browser.sessionstore.testmode".
|
||||
|
@ -1948,6 +1952,35 @@ let SessionStoreInternal = {
|
|||
LastSession.clear();
|
||||
},
|
||||
|
||||
/**
|
||||
* Revive a crashed tab and restore its state from before it crashed.
|
||||
*
|
||||
* @param aTab
|
||||
* A <xul:tab> linked to a crashed browser. This is a no-op if the
|
||||
* browser hasn't actually crashed, or is not associated with a tab.
|
||||
* This function will also throw if the browser happens to be remote.
|
||||
*/
|
||||
reviveCrashedTab(aTab) {
|
||||
if (!aTab) {
|
||||
throw new Error("SessionStore.reviveCrashedTab expected a tab, but got null.");
|
||||
}
|
||||
|
||||
let browser = aTab.linkedBrowser;
|
||||
if (!this._crashedBrowsers.has(browser.permanentKey)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Sanity check - the browser to be revived should not be remote
|
||||
// at this point.
|
||||
if (browser.isRemoteBrowser) {
|
||||
throw new Error("SessionStore.reviveCrashedTab: " +
|
||||
"Somehow a crashed browser is still remote.")
|
||||
}
|
||||
|
||||
let data = TabState.collect(aTab);
|
||||
this.restoreTab(aTab, data);
|
||||
},
|
||||
|
||||
/**
|
||||
* See if aWindow is usable for use when restoring a previous session via
|
||||
* restoreLastSession. If usable, prepare it for use.
|
||||
|
|
|
@ -87,18 +87,6 @@ this.TabCrashReporter = {
|
|||
}
|
||||
},
|
||||
|
||||
reloadCrashedTab: function (browser) {
|
||||
if (browser.isRemoteBrowser)
|
||||
return;
|
||||
|
||||
let doc = browser.contentDocument;
|
||||
if (!doc.documentURI.startsWith("about:tabcrashed"))
|
||||
return;
|
||||
|
||||
let url = browser.currentURI.spec;
|
||||
browser.loadURIWithFlags(url, Ci.nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null);
|
||||
},
|
||||
|
||||
onAboutTabCrashedLoad: function (aBrowser) {
|
||||
if (!this.childMap)
|
||||
return;
|
||||
|
|
Загрузка…
Ссылка в новой задаче