Bug 1424311 - Don't persist the certificate exception dialog's size so it doesn't grow unboundedly. r=jcj, a=RyanVM
authorDavid Keeler <dkeeler@mozilla.com>
Wed, 28 Mar 2018 13:43:03 -0700
changeset 462939 54d48c08e4c952384c7e31b391396f7f8784e247
parent 462938 d244d295cd2b3d8d8255716e37fd3107eaf6df66
child 462940 60416c55a73b8d65e15e81eadb52078b2550c680
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjcj, RyanVM
bugs1424311, 90276
milestone60.0
Bug 1424311 - Don't persist the certificate exception dialog's size so it doesn't grow unboundedly. r=jcj, a=RyanVM 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"/>