mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 862078 - Use an about:config preference to control multiprocess browsing, part 2 (r=felipe)
This commit is contained in:
parent
a4a18983d2
commit
767538ba27
@ -40,6 +40,10 @@ var FullZoom = {
|
||||
// Initialization & Destruction
|
||||
|
||||
init: function FullZoom_init() {
|
||||
// Bug 691614 - zooming support for electrolysis
|
||||
if (gMultiProcessBrowser)
|
||||
return;
|
||||
|
||||
// Listen for scrollwheel events so we can save scrollwheel-based changes.
|
||||
window.addEventListener("DOMMouseScroll", this, false);
|
||||
|
||||
@ -58,6 +62,10 @@ var FullZoom = {
|
||||
},
|
||||
|
||||
destroy: function FullZoom_destroy() {
|
||||
// Bug 691614 - zooming support for electrolysis
|
||||
if (gMultiProcessBrowser)
|
||||
return;
|
||||
|
||||
gPrefService.removeObserver("browser.zoom.", this);
|
||||
this._cps2.removeObserverForName(this.name, this);
|
||||
window.removeEventListener("DOMMouseScroll", this, false);
|
||||
@ -210,6 +218,10 @@ var FullZoom = {
|
||||
* (optional) browser object displaying the document
|
||||
*/
|
||||
onLocationChange: function FullZoom_onLocationChange(aURI, aIsTabSwitch, aBrowser) {
|
||||
// Bug 691614 - zooming support for electrolysis
|
||||
if (gMultiProcessBrowser)
|
||||
return;
|
||||
|
||||
if (!aURI || (aIsTabSwitch && !this.siteSpecific)) {
|
||||
this._notifyOnLocationChange();
|
||||
return;
|
||||
|
@ -25,6 +25,10 @@ let gGestureSupport = {
|
||||
* True to add/init listeners and false to remove/uninit
|
||||
*/
|
||||
init: function GS_init(aAddListener) {
|
||||
// Bug 863514 - Make gesture support work in electrolysis
|
||||
if (gMultiProcessBrowser)
|
||||
return;
|
||||
|
||||
const gestureEvents = ["SwipeGestureStart",
|
||||
"SwipeGestureUpdate", "SwipeGestureEnd", "SwipeGesture",
|
||||
"MagnifyGestureStart", "MagnifyGestureUpdate", "MagnifyGesture",
|
||||
@ -501,6 +505,10 @@ let gGestureSupport = {
|
||||
* image
|
||||
*/
|
||||
restoreRotationState: function() {
|
||||
// Bug 863514 - Make gesture support work in electrolysis
|
||||
if (gMultiProcessBrowser)
|
||||
return;
|
||||
|
||||
if (!(content.document instanceof ImageDocument))
|
||||
return;
|
||||
|
||||
|
@ -31,6 +31,10 @@ let gBrowserThumbnails = {
|
||||
_tabEvents: ["TabClose", "TabSelect"],
|
||||
|
||||
init: function Thumbnails_init() {
|
||||
// Bug 863512 - Make page thumbnails work in electrolysis
|
||||
if (gMultiProcessBrowser)
|
||||
return;
|
||||
|
||||
try {
|
||||
if (Services.prefs.getBoolPref("browser.pagethumbnails.capturing_disabled"))
|
||||
return;
|
||||
@ -51,6 +55,10 @@ let gBrowserThumbnails = {
|
||||
},
|
||||
|
||||
uninit: function Thumbnails_uninit() {
|
||||
// Bug 863512 - Make page thumbnails work in electrolysis
|
||||
if (gMultiProcessBrowser)
|
||||
return;
|
||||
|
||||
PageThumbs.removeExpirationFilter(this);
|
||||
gBrowser.removeTabsProgressListener(this);
|
||||
Services.prefs.removeObserver(this.PREF_DISK_CACHE_SSL, this);
|
||||
|
@ -804,7 +804,8 @@ var gBrowserInit = {
|
||||
|
||||
// enable global history
|
||||
try {
|
||||
gBrowser.docShell.QueryInterface(Ci.nsIDocShellHistory).useGlobalHistory = true;
|
||||
if (!gMultiProcessBrowser)
|
||||
gBrowser.docShell.QueryInterface(Ci.nsIDocShellHistory).useGlobalHistory = true;
|
||||
} catch(ex) {
|
||||
Cu.reportError("Places database may be locked: " + ex);
|
||||
}
|
||||
@ -2132,8 +2133,9 @@ function URLBarSetURI(aURI) {
|
||||
|
||||
// Replace initial page URIs with an empty string
|
||||
// only if there's no opener (bug 370555).
|
||||
// Bug 863515 - Make content.opener checks work in electrolysis.
|
||||
if (gInitialPages.indexOf(uri.spec) != -1)
|
||||
value = content.opener ? uri.spec : "";
|
||||
value = !gMultiProcessBrowser && content.opener ? uri.spec : "";
|
||||
else
|
||||
value = losslessDecodeURI(uri);
|
||||
|
||||
@ -3800,7 +3802,7 @@ var XULBrowserWindow = {
|
||||
this.setDefaultStatus(msg);
|
||||
|
||||
// Disable menu entries for images, enable otherwise
|
||||
if (content.document && mimeTypeIsTextBased(content.document.contentType))
|
||||
if (!gMultiProcessBrowser && content.document && mimeTypeIsTextBased(content.document.contentType))
|
||||
this.isImage.removeAttribute('disabled');
|
||||
else
|
||||
this.isImage.setAttribute('disabled', 'true');
|
||||
@ -3850,7 +3852,7 @@ var XULBrowserWindow = {
|
||||
}
|
||||
|
||||
// Disable menu entries for images, enable otherwise
|
||||
if (content.document && mimeTypeIsTextBased(content.document.contentType))
|
||||
if (!gMultiProcessBrowser && content.document && mimeTypeIsTextBased(content.document.contentType))
|
||||
this.isImage.removeAttribute('disabled');
|
||||
else
|
||||
this.isImage.setAttribute('disabled', 'true');
|
||||
@ -3866,7 +3868,7 @@ var XULBrowserWindow = {
|
||||
|
||||
var browser = gBrowser.selectedBrowser;
|
||||
if (aWebProgress.DOMWindow == content) {
|
||||
if ((location == "about:blank" && !content.opener) ||
|
||||
if ((location == "about:blank" && (gMultiProcessBrowser || !content.opener)) ||
|
||||
location == "") { // Second condition is for new tabs, otherwise
|
||||
// reload function is enabled until tab is refreshed.
|
||||
this.reloadCommand.setAttribute("disabled", "true");
|
||||
@ -3920,7 +3922,7 @@ var XULBrowserWindow = {
|
||||
}
|
||||
|
||||
// Disable find commands in documents that ask for them to be disabled.
|
||||
if (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)
|
||||
@ -4033,6 +4035,9 @@ var XULBrowserWindow = {
|
||||
gURLBar.removeAttribute("level");
|
||||
}
|
||||
|
||||
if (gMultiProcessBrowser)
|
||||
return;
|
||||
|
||||
// Don't pass in the actual location object, since it can cause us to
|
||||
// hold on to the window object too long. Just pass in the fields we
|
||||
// care about. (bug 424829)
|
||||
@ -4253,8 +4258,9 @@ var TabsProgressListener = {
|
||||
// We can't look for this during onLocationChange since at that point the
|
||||
// document URI is not yet the about:-uri of the error page.
|
||||
|
||||
let doc = aWebProgress.DOMWindow.document;
|
||||
if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
|
||||
let doc = gMultiProcessBrowser ? null : aWebProgress.DOMWindow.document;
|
||||
if (!gMultiProcessBrowser &&
|
||||
aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
|
||||
Components.isSuccessCode(aStatus) &&
|
||||
doc.documentURI.startsWith("about:") &&
|
||||
!doc.documentURI.toLowerCase().startsWith("about:blank") &&
|
||||
@ -6207,7 +6213,8 @@ function isTabEmpty(aTab) {
|
||||
if (!isBlankPageURL(browser.currentURI.spec))
|
||||
return false;
|
||||
|
||||
if (browser.contentWindow.opener)
|
||||
// Bug 863515 - Make content.opener checks work in electrolysis.
|
||||
if (!gMultiProcessBrowser && browser.contentWindow.opener)
|
||||
return false;
|
||||
|
||||
if (browser.sessionHistory && browser.sessionHistory.count >= 2)
|
||||
|
@ -452,6 +452,9 @@
|
||||
if (this.mBlank)
|
||||
return false;
|
||||
|
||||
if (gMultiProcessBrowser)
|
||||
return true;
|
||||
|
||||
// Don't show progress indicators in tabs for about: URIs
|
||||
// pointing to local resources.
|
||||
try {
|
||||
@ -529,8 +532,10 @@
|
||||
if (this._shouldShowProgress(aRequest)) {
|
||||
if (!(aStateFlags & nsIWebProgressListener.STATE_RESTORING)) {
|
||||
this.mTab.setAttribute("busy", "true");
|
||||
if (!(this.mBrowser.docShell.loadType & Ci.nsIDocShell.LOAD_CMD_RELOAD))
|
||||
this.mTabBrowser.setTabTitleLoading(this.mTab);
|
||||
if (!gMultiProcessBrowser) {
|
||||
if (!(this.mBrowser.docShell.loadType & Ci.nsIDocShell.LOAD_CMD_RELOAD))
|
||||
this.mTabBrowser.setTabTitleLoading(this.mTab);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.mTab.selected)
|
||||
@ -631,9 +636,11 @@
|
||||
|
||||
// Don't clear the favicon if this onLocationChange was
|
||||
// triggered by a pushState or a replaceState. See bug 550565.
|
||||
if (aWebProgress.isLoadingDocument &&
|
||||
!(this.mBrowser.docShell.loadType & Ci.nsIDocShell.LOAD_CMD_PUSHSTATE))
|
||||
this.mBrowser.mIconURL = null;
|
||||
if (!gMultiProcessBrowser) {
|
||||
if (aWebProgress.isLoadingDocument &&
|
||||
!(this.mBrowser.docShell.loadType & Ci.nsIDocShell.LOAD_CMD_PUSHSTATE))
|
||||
this.mBrowser.mIconURL = null;
|
||||
}
|
||||
|
||||
let autocomplete = this.mTabBrowser._placesAutocomplete;
|
||||
if (this.mBrowser.registeredOpenURI) {
|
||||
@ -755,6 +762,10 @@
|
||||
<parameter name="aTab"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
// Bug 691610 - e10s support for useDefaultIcon
|
||||
if (gMultiProcessBrowser)
|
||||
return;
|
||||
|
||||
var browser = this.getBrowserForTab(aTab);
|
||||
var docURIObject = browser.contentDocument.documentURIObject;
|
||||
var icon = null;
|
||||
@ -1035,15 +1046,18 @@
|
||||
|
||||
// Otherwise, focus the content area.
|
||||
let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
|
||||
let newFocusedElement = fm.getFocusedElementForWindow(window.content, true, {});
|
||||
|
||||
// for anchors, use FLAG_SHOWRING so that it is clear what link was
|
||||
// last clicked when switching back to that tab
|
||||
let focusFlags = fm.FLAG_NOSCROLL;
|
||||
if (newFocusedElement &&
|
||||
(newFocusedElement instanceof HTMLAnchorElement ||
|
||||
newFocusedElement.getAttributeNS("http://www.w3.org/1999/xlink", "type") == "simple"))
|
||||
focusFlags |= fm.FLAG_SHOWRING;
|
||||
|
||||
if (!gMultiProcessBrowser) {
|
||||
let newFocusedElement = fm.getFocusedElementForWindow(window.content, true, {});
|
||||
|
||||
// for anchors, use FLAG_SHOWRING so that it is clear what link was
|
||||
// last clicked when switching back to that tab
|
||||
if (newFocusedElement &&
|
||||
(newFocusedElement instanceof HTMLAnchorElement ||
|
||||
newFocusedElement.getAttributeNS("http://www.w3.org/1999/xlink", "type") == "simple"))
|
||||
focusFlags |= fm.FLAG_SHOWRING;
|
||||
}
|
||||
fm.setFocus(newBrowser, focusFlags);
|
||||
} while (false);
|
||||
}
|
||||
@ -1102,12 +1116,14 @@
|
||||
// At this point, we now have a URI.
|
||||
// Let's try to unescape it using a character set
|
||||
// in case the URI is not ASCII.
|
||||
try {
|
||||
var characterSet = browser.contentDocument.characterSet;
|
||||
const textToSubURI = Components.classes["@mozilla.org/intl/texttosuburi;1"]
|
||||
.getService(Components.interfaces.nsITextToSubURI);
|
||||
title = textToSubURI.unEscapeNonAsciiURI(characterSet, title);
|
||||
} catch(ex) { /* Do nothing. */ }
|
||||
if (!gMultiProcessBrowser) {
|
||||
try {
|
||||
var characterSet = browser.contentDocument.characterSet;
|
||||
const textToSubURI = Components.classes["@mozilla.org/intl/texttosuburi;1"]
|
||||
.getService(Components.interfaces.nsITextToSubURI);
|
||||
title = textToSubURI.unEscapeNonAsciiURI(characterSet, title);
|
||||
} catch(ex) { /* Do nothing. */ }
|
||||
}
|
||||
|
||||
crop = "center";
|
||||
|
||||
@ -1680,10 +1696,12 @@
|
||||
evt.initUIEvent("TabClose", true, false, window, aTabWillBeMoved ? 1 : 0);
|
||||
aTab.dispatchEvent(evt);
|
||||
|
||||
// Prevent this tab from showing further dialogs, since we're closing it
|
||||
var windowUtils = browser.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor).
|
||||
getInterface(Ci.nsIDOMWindowUtils);
|
||||
windowUtils.preventFurtherDialogs();
|
||||
if (!gMultiProcessBrowser) {
|
||||
// Prevent this tab from showing further dialogs, since we're closing it
|
||||
var windowUtils = browser.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor).
|
||||
getInterface(Ci.nsIDOMWindowUtils);
|
||||
windowUtils.preventFurtherDialogs();
|
||||
}
|
||||
|
||||
// Remove the tab's filter and progress listener.
|
||||
const filter = this.mTabFilters[aTab._tPos];
|
||||
|
Loading…
Reference in New Issue
Block a user