Bug 1331999: Fix race in setting initial popup background color. r?aswan draft
authorKris Maglione <maglione.k@gmail.com>
Wed, 18 Jan 2017 11:38:46 -0800
changeset 463256 a5a604c7e1495fd5257486f41c5c463259fea59a
parent 463255 013dfd2ab5e74097d81b0a2afebd3e02060f5e75
child 542618 b1824506d91e1bcd616ca5b327c824ee1f83dd61
push id42002
push usermaglione.k@gmail.com
push dateWed, 18 Jan 2017 19:39:12 +0000
reviewersaswan
bugs1331999
milestone53.0a1
Bug 1331999: Fix race in setting initial popup background color. r?aswan MozReview-Commit-ID: KgRTxRIFbVd
browser/components/extensions/ext-utils.js
--- a/browser/components/extensions/ext-utils.js
+++ b/browser/components/extensions/ext-utils.js
@@ -341,16 +341,17 @@ class BasePopup {
           <path d="M 0,10 L 10,0 20,10 z" fill="${borderColor}"/>
           <path d="M 1,10 L 10,1 19,10 z" fill="${background}"/>
         </svg>
       `)}")`;
     }
 
     this.panel.style.setProperty("--arrowpanel-background", panelBackground);
     this.panel.style.setProperty("--panel-arrow-image-vertical", panelArrow);
+    this.background = background;
   }
 }
 
 /**
  * A map of active popups for a given browser window.
  *
  * WeakMap[window -> WeakMap[Extension -> BasePopup]]
  */
@@ -470,16 +471,18 @@ class ViewPopup extends BasePopup {
       // Store the initial height of the view, so that we never resize menu panel
       // sub-views smaller than the initial height of the menu.
       this.viewHeight = this.viewNode.boxObject.height;
 
       // Calculate the extra height available on the screen above and below the
       // menu panel. Use that to calculate the how much the sub-view may grow.
       let popupRect = this.panel.getBoundingClientRect();
 
+      this.setBackground(this.background);
+
       let win = this.window;
       let popupBottom = win.mozInnerScreenY + popupRect.bottom;
       let popupTop = win.mozInnerScreenY + popupRect.top;
 
       let screenBottom = win.screen.availTop + win.screen.availHeight;
       this.extraHeight = {
         bottom: Math.max(0, screenBottom - popupBottom),
         top:  Math.max(0, popupTop - win.screen.availTop),