Bug 1365660: Part 1 - Add a remote="true" attribute to popups with remote browsers. r?mixedpuppy
Popups with remote browsers currently do not render correctly on any platform.
Since support for composited popups is marginal, at best, at the moment, we
only want to enable the features we need for these popups when they actually
contain remote content.
This bug adds an initial stopgap implementation, primarily for testing
purposes, that force enables compositing for remote popups, despite the UI
quirks it causes.
MozReview-Commit-ID: 2I6IJyIEdUd
--- a/browser/components/extensions/ExtensionPopups.jsm
+++ b/browser/components/extensions/ExtensionPopups.jsm
@@ -125,19 +125,21 @@ class BasePopup {
this.browser.remove();
}
if (this.viewNode) {
this.viewNode.removeEventListener(this.DESTROY_EVENT, this);
this.viewNode.style.maxHeight = "";
}
- if (this.panel) {
- this.panel.style.removeProperty("--arrowpanel-background");
- this.panel.style.removeProperty("--panel-arrow-image-vertical");
+ let {panel} = this;
+ if (panel) {
+ panel.style.removeProperty("--arrowpanel-background");
+ panel.style.removeProperty("--panel-arrow-image-vertical");
+ panel.removeAttribute("remote");
}
this.browser = null;
this.viewNode = null;
});
}
destroyBrowser(browser, finalize = false) {
@@ -372,16 +374,19 @@ class PanelPopup extends BasePopup {
let document = imageNode.ownerDocument;
let panel = document.createElement("panel");
panel.setAttribute("id", makeWidgetId(extension.id) + "-panel");
panel.setAttribute("class", "browser-extension-panel");
panel.setAttribute("tabspecific", "true");
panel.setAttribute("type", "arrow");
panel.setAttribute("role", "group");
+ if (extension.remote) {
+ panel.setAttribute("remote", "true");
+ }
document.getElementById("mainPopupSet").appendChild(panel);
super(extension, panel, popupURL, browserStyle);
this.contentReady.then(() => {
panel.openPopup(imageNode, "bottomcenter topright", 0, 0, false, false);
@@ -445,16 +450,20 @@ class ViewPopup extends BasePopup {
* Resolves when the browser is ready. Resolves to `false` if the
* browser was destroyed before it was fully loaded, and the popup
* should be closed, or `true` otherwise.
*/
async attach(viewNode) {
this.viewNode = viewNode;
this.viewNode.addEventListener(this.DESTROY_EVENT, this);
+ if (this.extension.remote) {
+ this.panel.setAttribute("remote", "true");
+ }
+
// Wait until the browser element is fully initialized, and give it at least
// a short grace period to finish loading its initial content, if necessary.
//
// In practice, the browser that was created by the mousdown handler should
// nearly always be ready by this point.
await Promise.all([
this.browserReady,
Promise.race([