From 16f8592aa9ef41685ab046d3a3c8a02ac275d677 Mon Sep 17 00:00:00 2001 From: Cameron Kaiser Date: Sun, 1 Oct 2017 14:59:23 -0700 Subject: [PATCH] #334: more tele from TabBrowser; also remove gMultiProcessBrowser since we don't support it --- browser/base/content/tabbrowser.xml | 68 +++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 18 deletions(-) diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index d36f51e85..65aa8721a 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -390,14 +390,15 @@ // When not using remote browsers, we can take a fast path by getting // directly from the content window to the browser without looping // over all browsers. - if (!gMultiProcessBrowser) { + //if (!gMultiProcessBrowser) { let browser = aWindow.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIWebNavigation) .QueryInterface(Ci.nsIDocShell) .chromeEventHandler; return this.getTabForBrowser(browser); - } + //} +/* for (let i = 0; i < this.browsers.length; i++) { // NB: We use contentWindowAsCPOW so that this code works both // for remote browsers as well. aWindow may be a CPOW. @@ -405,6 +406,7 @@ return this.tabs[i]; } return null; +*/ ]]> @@ -1007,6 +1009,7 @@ if (this.mCurrentBrowser == newBrowser && !aForceUpdate) return; +/* if (!aForceUpdate) { TelemetryStopwatch.start("FX_TAB_SWITCH_UPDATE_MS"); if (!Services.appinfo.browserTabsRemoteAutostart) { @@ -1016,6 +1019,7 @@ .beginTabSwitch(); } } +*/ var oldTab = this.mCurrentTab; @@ -1031,13 +1035,13 @@ var oldBrowser = this.mCurrentBrowser; - if (!gMultiProcessBrowser) { + //if (!gMultiProcessBrowser) { oldBrowser.setAttribute("type", "content-targetable"); oldBrowser.docShellIsActive = false; newBrowser.setAttribute("type", "content-primary"); newBrowser.docShellIsActive = (window.windowState != window.STATE_MINIMIZED); - } + //} var updateBlockedPopups = false; if ((oldBrowser.blockedPopups && !newBrowser.blockedPopups) || @@ -1185,13 +1189,13 @@ // We need to explicitly focus the new tab, because // tabbox.xml does this only in some cases. this.mCurrentTab.focus(); - } else if (gMultiProcessBrowser && document.activeElement !== newBrowser) { + } /* else if (gMultiProcessBrowser && document.activeElement !== newBrowser) { // Clear focus so that _adjustFocusAfterTabSwitch can detect if // some element has been focused and respect that. document.activeElement.blur(); - } + } */ - if (!gMultiProcessBrowser) + //if (!gMultiProcessBrowser) this._adjustFocusAfterTabSwitch(this.mCurrentTab); } @@ -1199,16 +1203,18 @@ this.tabContainer._setPositionalAttributes(); - if (!gMultiProcessBrowser) { + //if (!gMultiProcessBrowser) { let event = new CustomEvent("TabSwitchDone", { bubbles: true, cancelable: true }); this.dispatchEvent(event); - } + //} +/* if (!aForceUpdate) TelemetryStopwatch.finish("FX_TAB_SWITCH_UPDATE_MS"); +*/ ]]> @@ -1258,15 +1264,17 @@ // Don't focus the content area if something has been focused after the // tab switch was initiated. +/* if (gMultiProcessBrowser && document.activeElement != document.documentElement) return; +*/ // We're now committed to focusing the content area. let fm = Services.focus; let focusFlags = fm.FLAG_NOSCROLL; - if (!gMultiProcessBrowser) { + //if (!gMultiProcessBrowser) { let newFocusedElement = fm.getFocusedElementForWindow(window.content, true, {}); // for anchors, use FLAG_SHOWRING so that it is clear what link was @@ -1275,7 +1283,7 @@ (newFocusedElement instanceof HTMLAnchorElement || newFocusedElement.getAttributeNS("http://www.w3.org/1999/xlink", "type") == "simple")) focusFlags |= fm.FLAG_SHOWRING; - } + //} fm.setFocus(newBrowser, focusFlags); ]]> @@ -1560,9 +1568,10 @@ @@ -1629,20 +1639,25 @@ return; } +/* let remote = gMultiProcessBrowser && E10SUtils.canLoadURIInProcess(BROWSER_NEW_TAB_URL, Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT); +*/ +let remote = false; let browser = this._createBrowser({isPreloadBrowser: true, remote: remote}); this._preloadedBrowser = browser; let notificationbox = this.getNotificationBox(browser); this.mPanelContainer.appendChild(notificationbox); +/* if (remote) { // For remote browsers, we need to make sure that the webProgress is // instantiated, otherwise the parent won't get informed about the state // of the preloaded browser until it gets attached to a tab. browser.webProgress; } +*/ browser.loadURI(BROWSER_NEW_TAB_URL); browser.docShellIsActive = false; @@ -1656,7 +1671,7 @@ @@ -5448,6 +5478,7 @@ canvas.height = 90 * scale; let toDrag; let dragImageOffset = -16; +/* if (gMultiProcessBrowser) { var context = canvas.getContext('2d'); context.fillStyle = "white"; @@ -5473,13 +5504,14 @@ PageThumbs.captureToCanvas(browser, canvas); toDrag = this._dndPanel; } else { +*/ // For the non e10s case we can just use PageThumbs // sync. No need for xul magic, the native dnd will // be fine, so let's use the canvas for setDragImage. PageThumbs.captureToCanvas(browser, canvas); toDrag = canvas; dragImageOffset = dragImageOffset * scale; - } +// } dt.setDragImage(toDrag, dragImageOffset, dragImageOffset); // _dragData.offsetX/Y give the coordinates that the mouse should be @@ -5898,9 +5930,9 @@ this._logicallySelected = val; // If we're non-e10s we should update the visual selection as well at the same time - if (!gMultiProcessBrowser) { + //if (!gMultiProcessBrowser) { this._visuallySelected = val; - } + //} return val; ]]>