#441: remove e10s from browser.js

This commit is contained in:
Cameron Kaiser 2017-10-02 21:50:44 -07:00
parent 539efce0cc
commit b9509fba4d

View File

@ -95,11 +95,13 @@ var gLastBrowserCharset = null;
var gLastValidURLStr = ""; var gLastValidURLStr = "";
var gInPrintPreviewMode = false; var gInPrintPreviewMode = false;
var gContextMenu = null; // nsContextMenu instance var gContextMenu = null; // nsContextMenu instance
var gMultiProcessBrowser = var gMultiProcessBrowser = false; // always
/*
window.QueryInterface(Ci.nsIInterfaceRequestor) window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation) .getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsILoadContext) .QueryInterface(Ci.nsILoadContext)
.useRemoteTabs; .useRemoteTabs;
*/
var gAppInfo = Cc["@mozilla.org/xre/app-info;1"] var gAppInfo = Cc["@mozilla.org/xre/app-info;1"]
.getService(Ci.nsIXULAppInfo) .getService(Ci.nsIXULAppInfo)
.QueryInterface(Ci.nsIXULRuntime); .QueryInterface(Ci.nsIXULRuntime);
@ -267,6 +269,7 @@ var gInitialPages = [
]; ];
XPCOMUtils.defineLazyGetter(this, "Win7Features", function () { XPCOMUtils.defineLazyGetter(this, "Win7Features", function () {
/*
if (AppConstants.platform != "win") if (AppConstants.platform != "win")
return null; return null;
@ -287,6 +290,7 @@ XPCOMUtils.defineLazyGetter(this, "Win7Features", function () {
} }
}; };
} }
*/
return null; return null;
}); });
@ -863,13 +867,14 @@ function _loadURIWithFlags(browser, uri, params) {
let process = browser.isRemoteBrowser ? Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT let process = browser.isRemoteBrowser ? Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT
: Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT; : Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
let mustChangeProcess = gMultiProcessBrowser && let mustChangeProcess = false; /* gMultiProcessBrowser &&
!E10SUtils.canLoadURIInProcess(uri, process); !E10SUtils.canLoadURIInProcess(uri, process); */
try { try {
if (!mustChangeProcess) { //if (!mustChangeProcess) {
browser.webNavigation.loadURIWithOptions(uri, flags, browser.webNavigation.loadURIWithOptions(uri, flags,
referrer, referrerPolicy, referrer, referrerPolicy,
postData, null, null); postData, null, null);
/*
} else { } else {
if (postData) { if (postData) {
postData = NetUtil.readInputStreamToString(postData, postData.available()); postData = NetUtil.readInputStreamToString(postData, postData.available());
@ -883,6 +888,7 @@ function _loadURIWithFlags(browser, uri, params) {
postData: postData, postData: postData,
}); });
} }
*/
} catch (e) { } catch (e) {
// If anything goes wrong just switch remoteness manually and load the URI. // If anything goes wrong just switch remoteness manually and load the URI.
// We might lose history that way but at least the browser loaded a page. // We might lose history that way but at least the browser loaded a page.
@ -970,12 +976,12 @@ var gBrowserInit = {
window.QueryInterface(Ci.nsIDOMChromeWindow).browserDOMWindow = window.QueryInterface(Ci.nsIDOMChromeWindow).browserDOMWindow =
new nsBrowserAccess(); new nsBrowserAccess();
if (!gMultiProcessBrowser) { //if (!gMultiProcessBrowser) {
// There is a Content:Click message manually sent from content. // There is a Content:Click message manually sent from content.
Cc["@mozilla.org/eventlistenerservice;1"] Cc["@mozilla.org/eventlistenerservice;1"]
.getService(Ci.nsIEventListenerService) .getService(Ci.nsIEventListenerService)
.addSystemEventListener(gBrowser, "click", contentAreaClick, true); .addSystemEventListener(gBrowser, "click", contentAreaClick, true);
} //}
// hook up UI through progress listener // hook up UI through progress listener
gBrowser.addProgressListener(window.XULBrowserWindow); gBrowser.addProgressListener(window.XULBrowserWindow);
@ -1154,6 +1160,7 @@ var gBrowserInit = {
// be able to support remote browsers, and then make our selectedTab // be able to support remote browsers, and then make our selectedTab
// remote. // remote.
try { try {
/*
if (tabToOpen.linkedBrowser.isRemoteBrowser) { if (tabToOpen.linkedBrowser.isRemoteBrowser) {
if (!gMultiProcessBrowser) { if (!gMultiProcessBrowser) {
throw new Error("Cannot drag a remote browser into a window " + throw new Error("Cannot drag a remote browser into a window " +
@ -1162,6 +1169,7 @@ var gBrowserInit = {
gBrowser.updateBrowserRemoteness(gBrowser.selectedBrowser, true); gBrowser.updateBrowserRemoteness(gBrowser.selectedBrowser, true);
} }
*/
gBrowser.swapBrowsersAndCloseOther(gBrowser.selectedTab, tabToOpen); gBrowser.swapBrowsersAndCloseOther(gBrowser.selectedTab, tabToOpen);
} catch(e) { } catch(e) {
Cu.reportError(e); Cu.reportError(e);
@ -2327,9 +2335,11 @@ function BrowserViewSourceOfDocument(aArgsOrDocument) {
// that of the original URL, so disable remoteness if necessary for this // that of the original URL, so disable remoteness if necessary for this
// URL. // URL.
let contentProcess = Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT let contentProcess = Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT
let forceNotRemote = let forceNotRemote = false;
/*
gMultiProcessBrowser && gMultiProcessBrowser &&
!E10SUtils.canLoadURIInProcess(args.URL, contentProcess); !E10SUtils.canLoadURIInProcess(args.URL, contentProcess);
*/
// `viewSourceInBrowser` will load the source content from the page // `viewSourceInBrowser` will load the source content from the page
// descriptor for the tab (when possible) or fallback to the network if // descriptor for the tab (when possible) or fallback to the network if
// that fails. Either way, the view source module will manage the tab's // that fails. Either way, the view source module will manage the tab's
@ -2745,6 +2755,7 @@ var BrowserOnClick = {
}, },
handleEvent: function (event) { handleEvent: function (event) {
/*
if (!event.isTrusted || // Don't trust synthetic events if (!event.isTrusted || // Don't trust synthetic events
event.button == 2) { event.button == 2) {
return; return;
@ -2760,6 +2771,7 @@ var BrowserOnClick = {
ownerDoc.documentURI.toLowerCase() == "about:newtab") { ownerDoc.documentURI.toLowerCase() == "about:newtab") {
this.onE10sAboutNewTab(event, ownerDoc); this.onE10sAboutNewTab(event, ownerDoc);
} }
*/
}, },
receiveMessage: function (msg) { receiveMessage: function (msg) {
@ -3321,7 +3333,7 @@ var PrintPreviewListener = {
getPrintPreviewBrowser: function () { getPrintPreviewBrowser: function () {
if (!this._printPreviewTab) { if (!this._printPreviewTab) {
let browser = gBrowser.selectedTab.linkedBrowser; let browser = gBrowser.selectedTab.linkedBrowser;
let forceNotRemote = gMultiProcessBrowser && !browser.isRemoteBrowser; let forceNotRemote = false; //gMultiProcessBrowser && !browser.isRemoteBrowser;
this._tabBeforePrintPreview = gBrowser.selectedTab; this._tabBeforePrintPreview = gBrowser.selectedTab;
this._printPreviewTab = gBrowser.loadOneTab("about:blank", this._printPreviewTab = gBrowser.loadOneTab("about:blank",
{ inBackground: false, { inBackground: false,
@ -4372,6 +4384,7 @@ var XULBrowserWindow = {
// Check whether this URI should load in the current process // Check whether this URI should load in the current process
shouldLoadURI: function(aDocShell, aURI, aReferrer) { shouldLoadURI: function(aDocShell, aURI, aReferrer) {
/*
if (!gMultiProcessBrowser) if (!gMultiProcessBrowser)
return true; return true;
@ -4388,6 +4401,7 @@ var XULBrowserWindow = {
E10SUtils.redirectLoad(aDocShell, aURI, aReferrer); E10SUtils.redirectLoad(aDocShell, aURI, aReferrer);
return false; return false;
} }
*/
return true; return true;
}, },
@ -4578,7 +4592,7 @@ var XULBrowserWindow = {
} }
// Disable find commands in documents that ask for them to be disabled. // Disable find commands in documents that ask for them to be disabled.
if (!gMultiProcessBrowser && aLocationURI && if (/* !gMultiProcessBrowser && */ aLocationURI &&
(aLocationURI.schemeIs("about") || aLocationURI.schemeIs("chrome"))) { (aLocationURI.schemeIs("about") || aLocationURI.schemeIs("chrome"))) {
// Don't need to re-enable/disable find commands for same-document location changes // Don't need to re-enable/disable find commands for same-document location changes
// (e.g. the replaceStates in about:addons) // (e.g. the replaceStates in about:addons)
@ -6684,6 +6698,7 @@ function checkEmptyPageOrigin(browser = gBrowser.selectedBrowser,
return false; return false;
} }
let contentPrincipal = browser.contentPrincipal; let contentPrincipal = browser.contentPrincipal;
/*
if (gMultiProcessBrowser && browser.isRemoteBrowser && if (gMultiProcessBrowser && browser.isRemoteBrowser &&
!contentPrincipal && uri.spec == "about:blank") { !contentPrincipal && uri.spec == "about:blank") {
// Need to specialcase this because of how stopping an about:blank // Need to specialcase this because of how stopping an about:blank
@ -6691,6 +6706,7 @@ function checkEmptyPageOrigin(browser = gBrowser.selectedBrowser,
// see bug 1249362. // see bug 1249362.
return true; return true;
} }
*/
// Not all principals have URIs... // Not all principals have URIs...
if (contentPrincipal.URI) { if (contentPrincipal.URI) {
// A manually entered about:blank URI is slightly magical: // A manually entered about:blank URI is slightly magical:
@ -7725,7 +7741,7 @@ var TabContextMenu = {
if (AppConstants.E10S_TESTING_ONLY) { if (AppConstants.E10S_TESTING_ONLY) {
menuItems = aPopupMenu.getElementsByAttribute("tbattr", "tabbrowser-remote"); menuItems = aPopupMenu.getElementsByAttribute("tbattr", "tabbrowser-remote");
for (let menuItem of menuItems) for (let menuItem of menuItems)
menuItem.hidden = !gMultiProcessBrowser; menuItem.hidden = true; // !gMultiProcessBrowser;
} }
disabled = gBrowser.visibleTabs.length == 1; disabled = gBrowser.visibleTabs.length == 1;