Bug 1819082 - Wait for l10n in editcacert dialog. r=Gijs

Use mozSubDialogReady (same as for content subdialogs) as an extra
waiting point.

Differential Revision: https://phabricator.services.mozilla.com/D171127
This commit is contained in:
Emilio Cobos Álvarez 2023-02-27 22:38:16 +00:00
parent a41029fc5c
commit c31776da57
3 changed files with 19 additions and 15 deletions

View file

@ -12,20 +12,15 @@ var gCertDB = Cc["@mozilla.org/security/x509certdb;1"].getService(
*
* @type {nsIX509Cert}
*/
var gCert;
var gCert = window.arguments[0];
/**
* onload() handler.
*/
function onLoad() {
gCert = window.arguments[0];
document.mozSubdialogReady = init();
document.addEventListener("dialogaccept", onDialogAccept);
let certMsg = document.getElementById("certmsg");
document.l10n.setAttributes(certMsg, "edit-trust-ca", {
certName: gCert.commonName,
async function init() {
await new Promise(r => {
document.addEventListener("DOMContentLoaded", r, { once: true });
});
document.addEventListener("dialogaccept", onDialogAccept);
let sslCheckbox = document.getElementById("trustSSL");
sslCheckbox.checked = gCertDB.isCertTrusted(
@ -40,6 +35,14 @@ function onLoad() {
Ci.nsIX509Cert.CA_CERT,
Ci.nsIX509CertDB.TRUSTED_EMAIL
);
let certMsg = document.getElementById("certmsg");
document.l10n.pauseObserving();
document.l10n.setAttributes(certMsg, "edit-trust-ca", {
certName: gCert.commonName,
});
document.l10n.resumeObserving();
await document.l10n.translateElements([certMsg]);
}
/**

View file

@ -10,11 +10,9 @@
<window data-l10n-id="certmgr-edit-ca-cert2"
data-l10n-attrs="style"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
onload="onLoad();">
xmlns:html="http://www.w3.org/1999/xhtml">
<dialog id="editCaCert"
buttons="accept,cancel">
<linkset>
<html:link rel="localization" href="security/certificates/certManager.ftl"/>
</linkset>
@ -24,7 +22,7 @@
<description id="certmsg"/>
<separator/>
<description data-l10n-id="certmgr-edit-cert-edit-trust"></description>
<description data-l10n-id="certmgr-edit-cert-edit-trust"/>
<vbox align="start">
<checkbox data-l10n-id="certmgr-edit-cert-trust-ssl"
id="trustSSL"/>

View file

@ -350,6 +350,9 @@
if (this._translationReady) {
await this._translationReady;
}
if (document.mozSubDialogReady) {
await document.mozSubDialogReady;
}
let finalStep = () => {
this._sizeToPreferredSize();