mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 02:14:43 +00:00
Bug 1518786 - Wait until Fluent strings have been applied before sizing the window to content. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D16587 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
81b7d74f4a
commit
e79eecd7af
34
security/manager/pki/resources/content/exceptionDialog.css
Normal file
34
security/manager/pki/resources/content/exceptionDialog.css
Normal file
@ -0,0 +1,34 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
:root {
|
||||
max-width: 40em;
|
||||
}
|
||||
|
||||
#warningSupplemental {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.description {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.longDescription {
|
||||
/* 40em is the max-width of the dialog defined above.
|
||||
18px is the horizontal padding of the dialog. */
|
||||
width: calc(40em - 18px);
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
|
||||
#warningText,
|
||||
#warningSupplemental,
|
||||
#headerDescription,
|
||||
.longDescription {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.description:empty,
|
||||
.longDescription:empty {
|
||||
display: none;
|
||||
}
|
@ -22,7 +22,12 @@ function initExceptionDialog() {
|
||||
gNsISecTel = Ci.nsISecurityUITelemetry;
|
||||
let warningText = document.getElementById("warningText");
|
||||
document.l10n.setAttributes(warningText, "add-exception-branded-warning");
|
||||
gDialog.getButton("extra1").disabled = true;
|
||||
let confirmButton = gDialog.getButton("extra1");
|
||||
let l10nUpdatedElements = [
|
||||
confirmButton,
|
||||
warningText,
|
||||
];
|
||||
confirmButton.disabled = true;
|
||||
|
||||
var args = window.arguments;
|
||||
if (args && args[0]) {
|
||||
@ -35,7 +40,7 @@ function initExceptionDialog() {
|
||||
gSecInfo = args[0].securityInfo;
|
||||
gCert = gSecInfo.serverCert;
|
||||
gBroken = true;
|
||||
updateCertStatus();
|
||||
l10nUpdatedElements.concat(updateCertStatus());
|
||||
} else if (args[0].prefetchCert) {
|
||||
// We can optionally pre-fetch the certificate too. Don't do this
|
||||
// synchronously, since it would prevent the window from appearing
|
||||
@ -45,7 +50,7 @@ function initExceptionDialog() {
|
||||
// is appropriately responsive. Bug 453855
|
||||
document.getElementById("checkCertButton").disabled = true;
|
||||
gChecking = true;
|
||||
updateCertStatus();
|
||||
l10nUpdatedElements.concat(updateCertStatus());
|
||||
|
||||
window.setTimeout(checkCert, 0);
|
||||
}
|
||||
@ -54,7 +59,21 @@ function initExceptionDialog() {
|
||||
// Set out parameter to false by default
|
||||
args[0].exceptionAdded = false;
|
||||
}
|
||||
window.sizeToContent();
|
||||
|
||||
for (let id of [
|
||||
"warningSupplemental",
|
||||
"certLocationLabel",
|
||||
"checkCertButton",
|
||||
"statusDescription",
|
||||
"statusLongDescription",
|
||||
"viewCertButton",
|
||||
"permanent",
|
||||
]) {
|
||||
let element = document.getElementById(id);
|
||||
l10nUpdatedElements.push(element);
|
||||
}
|
||||
|
||||
document.l10n.translateElements(l10nUpdatedElements).then(() => window.sizeToContent());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -75,19 +94,20 @@ function grabCert(req, evt) {
|
||||
}
|
||||
gBroken = evt.type == "error";
|
||||
gChecking = false;
|
||||
updateCertStatus();
|
||||
document.l10n.translateElements(updateCertStatus()).then(() => window.sizeToContent());
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to download the certificate for the location specified, and populate
|
||||
* the Certificate Status section with the result.
|
||||
*/
|
||||
function checkCert() {
|
||||
async function checkCert() {
|
||||
gCert = null;
|
||||
gSecInfo = null;
|
||||
gChecking = true;
|
||||
gBroken = false;
|
||||
updateCertStatus();
|
||||
await document.l10n.translateElements(updateCertStatus());
|
||||
window.sizeToContent();
|
||||
|
||||
let uri = getURI();
|
||||
|
||||
@ -99,7 +119,7 @@ function checkCert() {
|
||||
req.send(null);
|
||||
} else {
|
||||
gChecking = false;
|
||||
updateCertStatus();
|
||||
document.l10n.translateElements(updateCertStatus()).then(() => window.sizeToContent());
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,6 +188,7 @@ function updateCertStatus() {
|
||||
var use2 = false;
|
||||
var use3 = false;
|
||||
let bucketId = gNsISecTel.WARNING_BAD_CERT_TOP_ADD_EXCEPTION_BASE;
|
||||
let l10nUpdatedElements = [];
|
||||
if (gCert) {
|
||||
if (gBroken) {
|
||||
var mms = "add-exception-domain-mismatch-short";
|
||||
@ -227,6 +248,7 @@ function updateCertStatus() {
|
||||
|
||||
let headerDescription = document.getElementById("headerDescription");
|
||||
document.l10n.setAttributes(headerDescription, "add-exception-invalid-header");
|
||||
l10nUpdatedElements.push(headerDescription);
|
||||
} else {
|
||||
shortDesc = "add-exception-valid-short";
|
||||
longDesc = "add-exception-valid-long";
|
||||
@ -263,12 +285,16 @@ function updateCertStatus() {
|
||||
let statusLongDescription = document.getElementById("statusLongDescription");
|
||||
document.l10n.setAttributes(statusDescription, shortDesc);
|
||||
document.l10n.setAttributes(statusLongDescription, longDesc);
|
||||
l10nUpdatedElements.push(statusDescription);
|
||||
l10nUpdatedElements.push(statusLongDescription);
|
||||
|
||||
if (use2) {
|
||||
let status2Description = document.getElementById("status2Description");
|
||||
let status2LongDescription = document.getElementById("status2LongDescription");
|
||||
document.l10n.setAttributes(status2Description, shortDesc2);
|
||||
document.l10n.setAttributes(status2LongDescription, longDesc2);
|
||||
l10nUpdatedElements.push(status2Description);
|
||||
l10nUpdatedElements.push(status2LongDescription);
|
||||
}
|
||||
|
||||
if (use3) {
|
||||
@ -276,10 +302,12 @@ function updateCertStatus() {
|
||||
let status3LongDescription = document.getElementById("status3LongDescription");
|
||||
document.l10n.setAttributes(status3Description, shortDesc3);
|
||||
document.l10n.setAttributes(status3LongDescription, longDesc3);
|
||||
l10nUpdatedElements.push(status3Description);
|
||||
l10nUpdatedElements.push(status3LongDescription);
|
||||
}
|
||||
|
||||
window.sizeToContent();
|
||||
gNeedReset = true;
|
||||
return l10nUpdatedElements;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,6 +4,7 @@
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://pippki/content/exceptionDialog.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE dialog>
|
||||
|
||||
@ -19,12 +20,14 @@
|
||||
defaultButton="extra2">
|
||||
|
||||
<linkset>
|
||||
<link rel="localization" href="security/certificates/certManager.ftl"/>
|
||||
<link rel="localization" href="branding/brand.ftl"/>
|
||||
<link rel="localization" href="security/certificates/certManager.ftl"/>
|
||||
</linkset>
|
||||
|
||||
<script type="application/javascript" src="chrome://pippki/content/pippki.js"/>
|
||||
<script type="application/javascript" src="chrome://pippki/content/exceptionDialog.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://pippki/content/pippki.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://pippki/content/exceptionDialog.js"/>
|
||||
|
||||
<hbox>
|
||||
<vbox>
|
||||
@ -38,38 +41,48 @@
|
||||
<vbox flex="1">
|
||||
<!-- Note that because of the styling, there must be no whitespace within
|
||||
the description tags -->
|
||||
<description id="warningText"
|
||||
style="white-space: pre-wrap"/>
|
||||
<description id="warningText"/>
|
||||
<description id="warningSupplemental"
|
||||
style="font-weight: bold; white-space: pre-wrap;"
|
||||
data-l10n-id="exception-mgr-supplemental-warning"></description>
|
||||
data-l10n-id="exception-mgr-supplemental-warning"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
|
||||
<hbox align="center">
|
||||
<label control="locationTextBox" data-l10n-id="exception-mgr-cert-location-url"/>
|
||||
<textbox id="locationTextBox" flex="1" oninput="handleTextChange();"
|
||||
value="https://" class="uri-element"/>
|
||||
<button id="checkCertButton" disabled="true" dlgtype="extra2"
|
||||
<label control="locationTextBox"
|
||||
id="certLocationLabel"
|
||||
data-l10n-id="exception-mgr-cert-location-url"/>
|
||||
<textbox id="locationTextBox"
|
||||
flex="1"
|
||||
oninput="handleTextChange();"
|
||||
value="https://"
|
||||
class="uri-element"/>
|
||||
<button id="checkCertButton"
|
||||
disabled="true"
|
||||
dlgtype="extra2"
|
||||
data-l10n-id="exception-mgr-cert-location-download"/>
|
||||
</hbox>
|
||||
|
||||
<hbox align="center">
|
||||
<description id="headerDescription" style="white-space: pre-wrap;"
|
||||
<description id="headerDescription"
|
||||
flex="1"/>
|
||||
<button id="viewCertButton" data-l10n-id="exception-mgr-cert-status-view-cert"
|
||||
disabled="true" oncommand="viewCertButtonClick();"/>
|
||||
<button id="viewCertButton"
|
||||
data-l10n-id="exception-mgr-cert-status-view-cert"
|
||||
disabled="true"
|
||||
oncommand="viewCertButtonClick();"/>
|
||||
</hbox>
|
||||
<description id="statusDescription"
|
||||
style="font-weight: bold; padding-bottom: 1em;"/>
|
||||
<description id="statusLongDescription" style="white-space: pre-wrap;"/>
|
||||
class="description"/>
|
||||
<description id="statusLongDescription"
|
||||
class="longDescription"/>
|
||||
<description id="status2Description"
|
||||
style="font-weight: bold; padding-bottom: 1em;"/>
|
||||
<description id="status2LongDescription" style="white-space: pre-wrap;"/>
|
||||
class="description"/>
|
||||
<description id="status2LongDescription"
|
||||
class="longDescription"/>
|
||||
<description id="status3Description"
|
||||
style="font-weight: bold; padding-bottom: 1em;"/>
|
||||
<description id="status3LongDescription" style="white-space: pre-wrap;"/>
|
||||
<spacer flex="1"/>
|
||||
<checkbox id="permanent" disabled="true"
|
||||
class="description"/>
|
||||
<description id="status3LongDescription"
|
||||
class="longDescription"/>
|
||||
<checkbox id="permanent"
|
||||
disabled="true"
|
||||
data-l10n-id="exception-mgr-permanent"/>
|
||||
</dialog>
|
||||
|
@ -24,6 +24,7 @@ pippki.jar:
|
||||
content/pippki/downloadcert.xul (content/downloadcert.xul)
|
||||
content/pippki/editcacert.js (content/editcacert.js)
|
||||
content/pippki/editcacert.xul (content/editcacert.xul)
|
||||
content/pippki/exceptionDialog.css (content/exceptionDialog.css)
|
||||
content/pippki/exceptionDialog.js (content/exceptionDialog.js)
|
||||
* content/pippki/exceptionDialog.xul (content/exceptionDialog.xul)
|
||||
content/pippki/load_device.js (content/load_device.js)
|
||||
|
Loading…
Reference in New Issue
Block a user