Bug 1365660: Part 1 - Add a remote="true" attribute to popups with remote browsers. r=mixedpuppy
authorKris Maglione <maglione.k@gmail.com>
Tue, 16 May 2017 14:12:57 -0700
changeset 409706 5e53d393c722f451c0e8dca642dbb1ace5331f6f
parent 409705 8b3ea20f546cf5cb975ab928f99280d8fc92898d
child 409707 cfe30fc6158c4dcb6c9fe2bc9bff35674ed9b247
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmixedpuppy
bugs1365660
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
browser/components/extensions/ExtensionPopups.jsm
--- 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([