bug 1424311 - don't persist the certificate exception dialog's size so it doesn't grow unboundedly r?jcj draft
authorDavid Keeler <dkeeler@mozilla.com>
Wed, 28 Mar 2018 13:43:03 -0700
changeset 774395 75f66aafe875d622c8d6fc182a4b89089bad2346
parent 773797 a456475502b80a1264642d9eaee9394a8fad8315
push id104383
push userbmo:dkeeler@mozilla.com
push dateWed, 28 Mar 2018 20:43:27 +0000
reviewersjcj
bugs1424311, 90276
milestone61.0a1
bug 1424311 - don't persist the certificate exception dialog's size so it doesn't grow unboundedly r?jcj window.sizeToContent() apparently interacts poorly with windows that have a persisted size (see bug 90276, which is a 5-digit bug that hasn't been touched in over a decade). As a workaround, don't persist the certificate exception dialog's size. This means we have to call window.sizeToContent() more often and unfortunately results in the window growing and shrinking again on Windows, but at least it will always be the "right size" for its content. MozReview-Commit-ID: 9UT3X8IEqZg
security/manager/pki/resources/content/exceptionDialog.js
security/manager/pki/resources/content/exceptionDialog.xul
--- a/security/manager/pki/resources/content/exceptionDialog.js
+++ b/security/manager/pki/resources/content/exceptionDialog.js
@@ -54,16 +54,17 @@ function initExceptionDialog() {
 
         window.setTimeout(checkCert, 0);
       }
     }
 
     // Set out parameter to false by default
     args[0].exceptionAdded = false;
   }
+  window.sizeToContent();
 }
 
 /**
  * Helper function for checkCert. Set as the onerror/onload callbacks for an
  * XMLHttpRequest. Sets gSSLStatus, gCert, gBroken, and gChecking according to
  * the load information from the request. Probably should not be used directly.
  *
  * @param {XMLHttpRequest} req
@@ -145,16 +146,17 @@ function resetDialog() {
   gDialog.getButton("extra1").disabled = true;
   setText("headerDescription", "");
   setText("statusDescription", "");
   setText("statusLongDescription", "");
   setText("status2Description", "");
   setText("status2LongDescription", "");
   setText("status3Description", "");
   setText("status3LongDescription", "");
+  window.sizeToContent();
 }
 
 /**
  * Called by input textboxes to manage UI state
  */
 function handleTextChange() {
   var checkCertButton = document.getElementById("checkCertButton");
   checkCertButton.disabled = !(document.getElementById("locationTextBox").value);
@@ -270,17 +272,16 @@ function updateCertStatus() {
   }
 
   if (use3) {
     setText("status3Description", gPKIBundle.getString(shortDesc3));
     setText("status3LongDescription", gPKIBundle.getString(longDesc3));
   }
 
   window.sizeToContent();
-
   gNeedReset = true;
 }
 
 /**
  * Handle user request to display certificate details
  */
 function viewCertButtonClick() {
   gSecHistogram.add(gNsISecTel.WARNING_BAD_CERT_TOP_CLICK_VIEW_CERT);
--- a/security/manager/pki/resources/content/exceptionDialog.xul
+++ b/security/manager/pki/resources/content/exceptionDialog.xul
@@ -9,21 +9,19 @@
 
 <dialog id="exceptiondialog"
         windowtype="mozilla:exceptiondialog"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         title="&exceptionMgr.title;"
         buttons="cancel,extra1,extra2"
         buttonlabelextra1="&exceptionMgr.exceptionButton.label;"
         buttonaccesskeyextra1="&exceptionMgr.exceptionButton.accesskey;"
-        style="width: 46em; min-height: 38em;"
         onload="initExceptionDialog();"
         ondialogextra1="addException();"
         ondialogextra2="checkCert();"
-        persist="screenX screenY width height"
         defaultButton="extra2">
 
   <stringbundleset id="stringbundleset">
     <stringbundle id="pippki_bundle" src="chrome://pippki/locale/pippki.properties"/>
     <stringbundle id="brand_bundle" src="chrome://branding/locale/brand.properties"/>
   </stringbundleset>
 
   <script type="application/javascript" src="chrome://pippki/content/pippki.js"/>