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
This commit is contained in:
Shane Caraveo 2018-03-14 09:12:26 -05:00
Родитель ad0f5aaafb
Коммит a62b33d946
3 изменённых файлов: 21 добавлений и 18 удалений

Просмотреть файл

@ -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([

Просмотреть файл

@ -375,6 +375,12 @@ function addXULBrowserDecorations(browser) {
swapBrowser() {},
};
}
if (browser._remoteWebProgress == undefined) {
browser._remoteWebProgress = {
addProgressListener() {},
removeProgressListener() {},
};
}
}
function tabLoaded(tab) {

Просмотреть файл

@ -49,24 +49,9 @@
<field name="_remoteWebProgress">null</field>
<property name="webProgress" readonly="true">
<getter>
<![CDATA[
if (!this._remoteWebProgress) {
// Don't attempt to create the remote web progress if the
// messageManager has already gone away
if (!this.messageManager)
return null;
let jsm = "resource://gre/modules/RemoteWebProgress.jsm";
let { RemoteWebProgressManager } = ChromeUtils.import(jsm, {});
this._remoteWebProgressManager = new RemoteWebProgressManager(this);
this._remoteWebProgress = this._remoteWebProgressManager.topLevelWebProgress;
}
return this._remoteWebProgress;
]]>
</getter>
</property>
<property name="webProgress"
onget="return this._remoteWebProgress;"
readonly="true"/>
<field name="_remoteFinder">null</field>
@ -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")) {