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