Bug 961863 - [e10s] Update browser remoteness attribute when restoring a tab (r=ttaubert,felipe)

This commit is contained in:
Bill McCloskey 2014-01-21 09:53:33 -08:00
Родитель bc76ace87c
Коммит 8a4e58ebff
3 изменённых файлов: 19 добавлений и 12 удалений

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

@ -2530,8 +2530,7 @@ function getWebNavigation()
function BrowserReloadWithFlags(reloadFlags) {
let url = gBrowser.currentURI.spec;
if (gBrowser._updateBrowserRemoteness(gBrowser.selectedBrowser,
gBrowser._shouldBrowserBeRemote(url))) {
if (gBrowser.updateBrowserRemoteness(gBrowser.selectedBrowser, url)) {
// If the remoteness has changed, the new browser doesn't have any
// information of what was loaded before, so we need to load the previous
// URL again.

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

@ -1338,13 +1338,15 @@
</method>
#ifdef MAKE_E10S_WORK
<method name="_updateBrowserRemoteness">
<method name="updateBrowserRemoteness">
<parameter name="aBrowser"/>
<parameter name="aRemote"/>
<parameter name="aURL"/>
<body>
<![CDATA[
let shouldBeRemote = this._shouldBrowserBeRemote(aURL);
let isRemote = aBrowser.getAttribute("remote") == "true";
if (isRemote == aRemote)
if (isRemote == shouldBeRemote)
return false;
let wasActive = document.activeElement == aBrowser;
@ -1358,13 +1360,13 @@
// Change the "remote" attribute.
let parent = aBrowser.parentNode;
parent.removeChild(aBrowser);
aBrowser.setAttribute("remote", aRemote ? "true" : "false");
aBrowser.setAttribute("remote", shouldBeRemote ? "true" : "false");
parent.appendChild(aBrowser);
// Restore the progress listener.
aBrowser.webProgress.addProgressListener(filter, Ci.nsIWebProgress.NOTIFY_ALL);
if (aRemote)
if (shouldBeRemote)
tab.setAttribute("remote", "true");
else
tab.removeAttribute("remote");
@ -2676,14 +2678,14 @@
<body>
<![CDATA[
#ifdef MAKE_E10S_WORK
this._updateBrowserRemoteness(this.mCurrentBrowser, this._shouldBrowserBeRemote(aURI));
this.updateBrowserRemoteness(this.mCurrentBrowser, aURI);
try {
#endif
return this.mCurrentBrowser.loadURI(aURI, aReferrerURI, aCharset);
#ifdef MAKE_E10S_WORK
} catch (e) {
let url = this.mCurrentBrowser.currentURI.spec;
this._updateBrowserRemoteness(this.mCurrentBrowser, this._shouldBrowserBeRemote(url));
this.updateBrowserRemoteness(this.mCurrentBrowser, url);
throw e;
}
#endif
@ -2701,14 +2703,14 @@
<body>
<![CDATA[
#ifdef MAKE_E10S_WORK
this._updateBrowserRemoteness(this.mCurrentBrowser, this._shouldBrowserBeRemote(aURI));
this.updateBrowserRemoteness(this.mCurrentBrowser, aURI);
try {
#endif
return this.mCurrentBrowser.loadURIWithFlags(aURI, aFlags, aReferrerURI, aCharset, aPostData);
#ifdef MAKE_E10S_WORK
} catch (e) {
let url = this.mCurrentBrowser.currentURI.spec;
this._updateBrowserRemoteness(this.mCurrentBrowser, this._shouldBrowserBeRemote(url));
this.updateBrowserRemoteness(this.mCurrentBrowser, url);
throw e;
}
#endif
@ -3220,7 +3222,7 @@
let uri = browser.currentURI;
let icon = browser.mIconURL;
this._updateBrowserRemoteness(browser, false);
this.updateBrowserRemoteness(browser, "about:tabcrashed");
browser.setAttribute("crashedPageTitle", title);
browser.docShell.displayLoadError(Cr.NS_ERROR_CONTENT_CRASHED, uri, null);

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

@ -2745,6 +2745,12 @@ let SessionStoreInternal = {
pageStyle: tabData.pageStyle || null
});
// In electrolysis, we may need to change the browser's remote
// attribute so that it runs in a content process.
let activePageData = tabData.entries[activeIndex] || null;
let uri = activePageData ? activePageData.url || null : null;
tabbrowser.updateBrowserRemoteness(browser, uri);
browser.messageManager.sendAsyncMessage("SessionStore:restoreHistory",
{tabData: tabData, epoch: epoch});