Bug 1523696 - Wait until the style attribute is applied to the dialog before sizing it. r=Gijs a=RyanVM
authorJared Wein <jwein@mozilla.com>
Fri, 08 Feb 2019 03:47:33 +0000
changeset 515835 b61d0fdc785b3dd4deafd0e29a3a3116d52cc11f
parent 515834 bc23b491541e589b832b4605f188c22260f0f957
child 515836 ee2b9d8d4b0b0b30c45d61977a979e3c7d762692
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, RyanVM
bugs1523696
milestone66.0
Bug 1523696 - Wait until the style attribute is applied to the dialog before sizing it. r=Gijs a=RyanVM Differential Revision: https://phabricator.services.mozilla.com/D19037
browser/base/content/sanitizeDialog.js
--- a/browser/base/content/sanitizeDialog.js
+++ b/browser/base/content/sanitizeDialog.js
@@ -47,16 +47,25 @@ var gSanitizePromptDialog = {
         document.l10n.translateFragment(warningDesc).then(() => {
           // And then ensure we've run layout.
           let rootWin = window.docShell.rootTreeItem.QueryInterface(Ci.nsIDocShell).domWindow;
           return rootWin.promiseDocumentFlushed(() => {});
         });
     } else {
       this.warningBox.hidden = true;
     }
+
+    // Only apply the following if the dialog is opened outside of the Preferences.
+    if (!("gSubDialog" in window.opener)) {
+      // The style attribute on the dialog may get set after the dialog has been sized.
+      // Force the dialog to size again after the style attribute has been applied.
+      document.l10n.translateElements([document.documentElement]).then(() => {
+        window.sizeToContent();
+      });
+    }
   },
 
   selectByTimespan() {
     // This method is the onselect handler for the duration dropdown.  As a
     // result it's called a couple of times before onload calls init().
     if (!this._inited)
       return;