From a62b33d94697bbc729b144bbbe28eb8512277327 Mon Sep 17 00:00:00 2001 From: Shane Caraveo Date: Wed, 14 Mar 2018 09:12:26 -0500 Subject: [PATCH] Bug 1445080 - fix handling of remote web progress for non-tab browsers, r=Gijs,mconley Ensure remoteWebProgress is initialized for remote browsers. Includes devtools fix from jryans. MozReview-Commit-ID: Ce3TzwkNnyi --HG-- extra : rebase_source : 0f2bcb96ef04f4eaee447180dc21400dca3bf410 --- .../browser_ext_sidebarAction_runtime.js | 4 +++ .../client/responsive.html/browser/swap.js | 6 ++++ toolkit/content/widgets/remote-browser.xml | 29 +++++++------------ 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/browser/components/extensions/test/browser/browser_ext_sidebarAction_runtime.js b/browser/components/extensions/test/browser/browser_ext_sidebarAction_runtime.js index 903127483479..5a0caefc586c 100644 --- a/browser/components/extensions/test/browser/browser_ext_sidebarAction_runtime.js +++ b/browser/components/extensions/test/browser/browser_ext_sidebarAction_runtime.js @@ -47,6 +47,10 @@ add_task(async function test_sidebar_disconnect() { await extension.startup(); await connected; + // Bug 1445080 fixes currentURI, test to avoid future breakage. + let currentURI = window.SidebarUI.browser.contentDocument.getElementById("webext-panels-browser").currentURI; + is(currentURI.scheme, "moz-extension", "currentURI is set correctly"); + // switching sidebar to another extension let extension2 = ExtensionTestUtils.loadExtension(extensionData); let switched = Promise.all([ diff --git a/devtools/client/responsive.html/browser/swap.js b/devtools/client/responsive.html/browser/swap.js index b99e04fc6351..e8277b90a785 100644 --- a/devtools/client/responsive.html/browser/swap.js +++ b/devtools/client/responsive.html/browser/swap.js @@ -375,6 +375,12 @@ function addXULBrowserDecorations(browser) { swapBrowser() {}, }; } + if (browser._remoteWebProgress == undefined) { + browser._remoteWebProgress = { + addProgressListener() {}, + removeProgressListener() {}, + }; + } } function tabLoaded(tab) { diff --git a/toolkit/content/widgets/remote-browser.xml b/toolkit/content/widgets/remote-browser.xml index f82d1756ee06..a98aa5149ef4 100644 --- a/toolkit/content/widgets/remote-browser.xml +++ b/toolkit/content/widgets/remote-browser.xml @@ -49,24 +49,9 @@ null - - - - - + null @@ -413,6 +398,14 @@ this.messageManager.addMessageListener("DOMFullscreen:RequestExit", this); this.messageManager.addMessageListener("DOMFullscreen:RequestRollback", this); this.messageManager.addMessageListener("MozApplicationManifest", this); + + // browser-child messages, such as Content:LocationChange, are handled in + // RemoteWebProgress, ensure it is loaded and ready. + let jsm = "resource://gre/modules/RemoteWebProgress.jsm"; + let { RemoteWebProgressManager } = ChromeUtils.import(jsm, {}); + this._remoteWebProgressManager = new RemoteWebProgressManager(this); + this._remoteWebProgress = this._remoteWebProgressManager.topLevelWebProgress; + this.messageManager.loadFrameScript("chrome://global/content/browser-child.js", true); if (this.hasAttribute("selectmenulist")) {