From 767538ba27752b1ec34802b1e80874fee6c6c033 Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Mon, 22 Apr 2013 19:47:52 -0700 Subject: [PATCH] Bug 862078 - Use an about:config preference to control multiprocess browsing, part 2 (r=felipe) --- browser/base/content/browser-fullZoom.js | 12 ++++ .../base/content/browser-gestureSupport.js | 8 +++ browser/base/content/browser-thumbnails.js | 8 +++ browser/base/content/browser.js | 25 +++++--- browser/base/content/tabbrowser.xml | 64 ++++++++++++------- 5 files changed, 85 insertions(+), 32 deletions(-) diff --git a/browser/base/content/browser-fullZoom.js b/browser/base/content/browser-fullZoom.js index ebcaaa0e091..67b1c52a702 100644 --- a/browser/base/content/browser-fullZoom.js +++ b/browser/base/content/browser-fullZoom.js @@ -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; diff --git a/browser/base/content/browser-gestureSupport.js b/browser/base/content/browser-gestureSupport.js index 31e75f849eb..152a5b52f32 100644 --- a/browser/base/content/browser-gestureSupport.js +++ b/browser/base/content/browser-gestureSupport.js @@ -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; diff --git a/browser/base/content/browser-thumbnails.js b/browser/base/content/browser-thumbnails.js index 810c16d67dd..dbe33e3ed2f 100644 --- a/browser/base/content/browser-thumbnails.js +++ b/browser/base/content/browser-thumbnails.js @@ -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); diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index b64fd102367..dc31abec86f 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -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) diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index 9a16a0fdf08..2e340c2f85c 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -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 @@