Bug 1557252 - add missing style for in-content dialogs, r=bgrins
☠☠ backed out by 7f307bf3d52a ☠ ☠
authorAlexander Surkov <surkov.alexander@gmail.com>
Thu, 06 Jun 2019 15:56:34 +0000
changeset 477622 584e6d9246ac3cfa73d6bb0abfe88294cb309856
parent 477621 cc4570fed4521588f23a25f6acab5ac02f957baa
child 477623 bffc5993b912cbab7d012775abacad52fa5d5cdc
push id36119
push userncsoregi@mozilla.com
push dateThu, 06 Jun 2019 21:52:09 +0000
treeherdermozilla-central@6a81efd823db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgrins
bugs1557252
milestone69.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 1557252 - add missing style for in-content dialogs, r=bgrins Differential Revision: https://phabricator.services.mozilla.com/D33976
browser/components/preferences/in-content/subdialogs.js
toolkit/content/widgets/dialog.js
--- a/browser/components/preferences/in-content/subdialogs.js
+++ b/browser/components/preferences/in-content/subdialogs.js
@@ -215,17 +215,17 @@ SubDialog.prototype = {
       return;
     }
 
     for (let styleSheetURL of this._injectedStyleSheets) {
       this.injectXMLStylesheet(styleSheetURL);
     }
 
     // Provide the ability for the dialog to know that it is being loaded "in-content".
-    this._frame.contentDocument.documentElement.setAttribute("subdialog", "true");
+    this._frame.contentDocument.documentElement.setInContent();
 
     this._frame.contentWindow.addEventListener("dialogclosing", this);
 
     let oldResizeBy = this._frame.contentWindow.resizeBy;
     this._frame.contentWindow.resizeBy = (resizeByWidth, resizeByHeight) => {
       // Only handle resizeByHeight currently.
       let frameHeight = this._frame.clientHeight;
       let boxMinHeight = parseFloat(getComputedStyle(this._box).minHeight, 10);
--- a/toolkit/content/widgets/dialog.js
+++ b/toolkit/content/widgets/dialog.js
@@ -134,16 +134,27 @@ class MozDialog extends MozXULElement {
     this._l10nButtons = [];
 
     this._configureButtons(this.buttons);
 
     window.moveToAlertPosition = this.moveToAlertPosition;
     window.centerWindowOnScreen = this.centerWindowOnScreen;
   }
 
+  setInContent() {
+    console.assert(this.isConnectedAndReady, "Shall be called after connectedCallback");
+
+    if (!this.hasAttribute("subdialog")) {
+      this.setAttribute("subdialog", "true");
+      this.shadowRoot.appendChild(MozXULElement.parseXULToFragment(
+        `<html:link rel="stylesheet" href="chrome://global/skin/in-content/common.css" />`
+      ));
+    }
+  }
+
   set buttons(val) {
     this._configureButtons(val);
     return val;
   }
 
   get buttons() {
     return this.getAttribute("buttons");
   }