Bug 1651537 - Fix Linter failures due to new 'prefer-formatValues' rule. r=darktrojan DONTBUILD

--HG--
extra : histedit_source : 7583032704d88f48a8d6510441bb027f46aed9dd
This commit is contained in:
Alessandro Castellani 2020-07-08 17:16:05 -07:00
Родитель 40e353cb48
Коммит 066a856710
13 изменённых файлов: 138 добавлений и 115 удалений

Просмотреть файл

@ -223,10 +223,15 @@ async function importRemainingItems(event) {
? "calendar-ics-file-import-success" ? "calendar-ics-file-import-success"
: "calendar-ics-file-import-error"; : "calendar-ics-file-import-error";
let messageElement = document.getElementById("calendar-ics-file-dialog-message"); let [msgValue, btnLabel] = await document.l10n.formatValues([
messageElement.value = await document.l10n.formatValue(messageIdentifier); { id: messageIdentifier },
{ id: "calendar-ics-file-accept-button-ok-label" },
]);
acceptButton.label = await document.l10n.formatValue("calendar-ics-file-accept-button-ok-label"); let messageElement = document.getElementById("calendar-ics-file-dialog-message");
messageElement.value = msgValue;
acceptButton.label = btnLabel;
acceptButton.disabled = false; acceptButton.disabled = false;
} }

Просмотреть файл

@ -187,8 +187,11 @@ var gCategoriesPane = {
} }
if (categoryName.toLowerCase() == gCategoryList[i].toLowerCase()) { if (categoryName.toLowerCase() == gCategoryList[i].toLowerCase()) {
let title = await document.l10n.formatValue("category-overwrite-title"); let [title, description] = await document.l10n.formatValues([
let description = await document.l10n.formatValue("category-overwrite"); { id: "category-overwrite-title" },
{ id: "category-overwrite" },
]);
if (Services.prompt.confirm(null, title, description)) { if (Services.prompt.confirm(null, title, description)) {
if (list.selectedIndex != -1) { if (list.selectedIndex != -1) {
// Don't delete the old category yet. It will mess up indices. // Don't delete the old category yet. It will mess up indices.

Просмотреть файл

@ -13,15 +13,12 @@ var otrAddFinger = {
this.fingerError = document.getElementById("fingerError"); this.fingerError = document.getElementById("fingerError");
this.keyCount = document.getElementById("keyCount"); this.keyCount = document.getElementById("keyCount");
let description = await document.l10n.formatValue( let [description, warningTooltip] = await document.l10n.formatValues([
"otr-add-finger-description", { id: "otr-add-finger-description", args: { name: args.screenname } },
{ name: args.screenname } { id: "otr-add-finger-tooltip-error" },
); ]);
document.getElementById("otrDescription").textContent = description;
let warningTooltip = await document.l10n.formatValue( document.getElementById("otrDescription").textContent = description;
"otr-add-finger-tooltip-error"
);
this.fingerWarning.setAttribute("tooltiptext", warningTooltip); this.fingerWarning.setAttribute("tooltiptext", warningTooltip);
document.addEventListener("dialogaccept", event => { document.addEventListener("dialogaccept", event => {

Просмотреть файл

@ -37,17 +37,13 @@ async function populateFingers(context, theirs, trust) {
throw new Error("Fingerprint should already be generated."); throw new Error("Fingerprint should already be generated.");
} }
document.getElementById( let [yourFPLabel, theirFPLabel] = await document.l10n.formatValues([
"yourFPLabel" { id: "auth-your-fp-value", args: { own_name: context.account } },
).value = await document.l10n.formatValue("auth-your-fp-value", { { id: "auth-their-fp-value", args: { their_name: context.username } },
own_name: context.account, ]);
});
document.getElementById( document.getElementById("yourFPLabel").value = yourFPLabel;
"theirFPLabel" document.getElementById("theirFPLabel").value = theirFPLabel;
).value = await document.l10n.formatValue("auth-their-fp-value", {
their_name: context.username,
});
document.getElementById("yourFPValue").value = yours; document.getElementById("yourFPValue").value = yours;
document.getElementById("theirFPValue").value = theirs; document.getElementById("theirFPValue").value = theirs;
@ -202,8 +198,11 @@ var otrAuth = {
}, },
async help() { async help() {
let helpTitle = await document.l10n.formatValue("auth-helpTitle"); let [helpTitle, helpText] = await document.l10n.formatValues([
let helpText = await document.l10n.formatValue("auth-help"); { id: "auth-helpTitle" },
{ id: "auth-help" },
]);
Services.prompt.alert(window, helpTitle, helpText); Services.prompt.alert(window, helpTitle, helpText);
}, },
}; };

Просмотреть файл

@ -35,14 +35,15 @@ var gAttachmentReminderOptionsDialog = {
async addKeyword() { async addKeyword() {
var input = { value: "" }; // Default to empty. var input = { value: "" }; // Default to empty.
var ok = Services.prompt.prompt(
window, let [title, message] = await document.l10n.formatValues([
await document.l10n.formatValue("new-keyword-title"), { id: "new-keyword-title" },
await document.l10n.formatValue("new-keyword-label"), { id: "new-keyword-label" },
input, ]);
null,
{ value: 0 } var ok = Services.prompt.prompt(window, title, message, input, null, {
); value: 0,
});
if (ok && input.value) { if (ok && input.value) {
let newKey = this.keywordListBox.appendItem(input.value, input.value); let newKey = this.keywordListBox.appendItem(input.value, input.value);
this.keywordListBox.ensureElementIsVisible(newKey); this.keywordListBox.ensureElementIsVisible(newKey);
@ -56,14 +57,15 @@ var gAttachmentReminderOptionsDialog = {
} }
var keywordToEdit = this.keywordListBox.selectedItem; var keywordToEdit = this.keywordListBox.selectedItem;
var input = { value: keywordToEdit.getAttribute("value") }; var input = { value: keywordToEdit.getAttribute("value") };
var ok = Services.prompt.prompt(
window, let [title, message] = await document.l10n.formatValues([
await document.l10n.formatValue("edit-keyword-title"), { id: "edit-keyword-title" },
await document.l10n.formatValue("edit-keyword-label"), { id: "edit-keyword-label" },
input, ]);
null,
{ value: 0 } var ok = Services.prompt.prompt(window, title, message, input, null, {
); value: 0,
});
if (ok && input.value) { if (ok && input.value) {
this.keywordListBox.selectedItem.value = input.value; this.keywordListBox.selectedItem.value = input.value;
this.keywordListBox.selectedItem.label = input.value; this.keywordListBox.selectedItem.label = input.value;

Просмотреть файл

@ -422,11 +422,15 @@ function DeleteSignon() {
async function DeleteAllSignons() { async function DeleteAllSignons() {
// Confirm the user wants to remove all passwords // Confirm the user wants to remove all passwords
let dummy = { value: false }; let dummy = { value: false };
let [title, message] = await document.l10n.formatValues([
{ id: "remove-all-passwords-title" },
{ id: "remove-all-passwords-prompt" },
]);
if ( if (
Services.prompt.confirmEx( Services.prompt.confirmEx(
window, window,
await document.l10n.formatValue("remove-all-passwords-title"), title,
await document.l10n.formatValue("remove-all-passwords-prompt"), message,
Services.prompt.STD_YES_NO_BUTTONS + Services.prompt.BUTTON_POS_1_DEFAULT, Services.prompt.STD_YES_NO_BUTTONS + Services.prompt.BUTTON_POS_1_DEFAULT,
null, null,
null, null,

Просмотреть файл

@ -137,8 +137,10 @@ var gPermissionManager = {
principal.origin; principal.origin;
} }
} catch (ex) { } catch (ex) {
var message = await document.l10n.formatValue("invalid-uri-message"); let [title, message] = await document.l10n.formatValues([
var title = await document.l10n.formatValue("invalid-uri-title"); { id: "invalid-uri-title" },
{ id: "invalid-uri-message" },
]);
Services.prompt.alert(window, title, message); Services.prompt.alert(window, title, message);
return; return;
} }

Просмотреть файл

@ -899,22 +899,20 @@ async function enigmailDeleteKey(key) {
// Interrupt if the selected key is currently being used. // Interrupt if the selected key is currently being used.
if (key.keyId == gIdentity.getUnicharAttribute("openpgp_key_id")) { if (key.keyId == gIdentity.getUnicharAttribute("openpgp_key_id")) {
let alertTitle = await document.l10n.formatValue("delete-key-in-use-title"); let [alertTitle, alertDescription] = await document.l10n.formatValues([
let alertDescription = await document.l10n.formatValue( { id: "delete-key-in-use-title" },
"delete-key-in-use-description" { id: "delete-key-in-use-description" },
); ]);
Services.prompt.alert(null, alertTitle, alertDescription); Services.prompt.alert(null, alertTitle, alertDescription);
return; return;
} }
let l10nKey = key.secretAvailable ? "delete-secret-key" : "delete-pub-key"; let l10nKey = key.secretAvailable ? "delete-secret-key" : "delete-pub-key";
let title = await document.l10n.formatValue("delete-key-title", { let [title, description] = await document.l10n.formatValues([
userId: key.userId, { id: "delete-key-title", args: { userId: key.userId } },
}); { id: l10nKey, args: { userId: key.userId } },
let description = await document.l10n.formatValue(l10nKey, { ]);
userId: key.userId,
});
// Ask for confirmation before proceeding. // Ask for confirmation before proceeding.
if (!Services.prompt.confirm(null, title, description)) { if (!Services.prompt.confirm(null, title, description)) {
@ -1203,12 +1201,22 @@ async function openPgpExportKey(keyId, exportSecret = false) {
let ext = exportSecret ? "pub-sec.asc" : "pub.asc"; let ext = exportSecret ? "pub-sec.asc" : "pub.asc";
let filename = `${gIdentity.fullName}_${gIdentity.email}-${keyId}-${ext}`; let filename = `${gIdentity.fullName}_${gIdentity.email}-${keyId}-${ext}`;
let filePicker = exportSecret let [
? await document.l10n.formatValue("export-keypair-to-file") exportKeyPair,
: await document.l10n.formatValue("export-to-file"); exportKey,
fileType,
saveOk,
] = await document.l10n.formatValues([
{ id: "export-keypair-to-file" },
{ id: "export-to-file" },
{ id: "ascii-armor-file" },
{ id: "save-keys-ok" },
]);
let filePicker = exportSecret ? exportKeyPair : exportKey;
let outFile = EnigFilePicker(filePicker, "", true, "*.asc", filename, [ let outFile = EnigFilePicker(filePicker, "", true, "*.asc", filename, [
await document.l10n.formatValue("ascii-armor-file"), fileType,
"*.asc", "*.asc",
]); ]);
if (!outFile) { if (!outFile) {
@ -1236,7 +1244,5 @@ async function openPgpExportKey(keyId, exportSecret = false) {
} }
// Let the user know that the save was successful. // Let the user know that the save was successful.
document.l10n.formatValue("save-keys-ok").then(value => { alertUser(saveOk);
alertUser(value);
});
} }

Просмотреть файл

@ -604,12 +604,23 @@ async function enigmailExportKeys() {
var exportSecretKey = false; var exportSecretKey = false;
if (secretFound) { if (secretFound) {
let [
msgtext,
dialogTitle,
button1,
button2,
] = await document.l10n.formatValues([
{ id: "export-secret-key" },
{ id: "enig-confirm" },
{ id: "key-man-button-export-pub-key" },
{ id: "key-man-button-export-sec-key" },
]);
// double check that also the pivate keys shall be exported // double check that also the pivate keys shall be exported
var r = EnigmailDialog.msgBox(window, { var r = EnigmailDialog.msgBox(window, {
msgtext: await document.l10n.formatValue("export-secret-key"), msgtext,
dialogTitle: await document.l10n.formatValue("enig-confirm"), dialogTitle,
button1: await document.l10n.formatValue("key-man-button-export-pub-key"), button1,
button2: await document.l10n.formatValue("key-man-button-export-sec-key"), button2,
cancelButton: ":cancel", cancelButton: ":cancel",
iconType: EnigmailConstants.ICONTYPE_QUESTION, iconType: EnigmailConstants.ICONTYPE_QUESTION,
}); });

Просмотреть файл

@ -130,14 +130,15 @@ async function saveRevCert(inputKeyFile, keyId, uid, resolve, reject) {
let defaultFileName = uid.replace(/[\\/<>]/g, ""); let defaultFileName = uid.replace(/[\\/<>]/g, "");
defaultFileName += " (0x" + keyId + ") rev.asc"; defaultFileName += " (0x" + keyId + ") rev.asc";
let outFile = EnigFilePicker( let [title, fileType] = await document.l10n.formatValues([
await document.l10n.formatValue("save-revoke-cert-as"), { id: "save-revoke-cert-as" },
"", { id: "ascii-armor-file" },
true, ]);
let outFile = EnigFilePicker(title, "", true, "*.asc", defaultFileName, [
fileType,
"*.asc", "*.asc",
defaultFileName, ]);
[await document.l10n.formatValue("ascii-armor-file"), "*.asc"]
);
if (outFile) { if (outFile) {
try { try {
@ -232,16 +233,12 @@ async function enigmailKeygenStart() {
idString += " <" + userEmail + ">"; idString += " <" + userEmail + ">";
var confirmMsg = await document.l10n.formatValue("key-confirm", { let [confirmMsg, confirmBtn] = await document.l10n.formatValues([
id: idString, { id: "key-confirm", args: { id: idString } },
}); { id: "key-man-button-generate-key" },
]);
if ( if (!EnigConfirm(confirmMsg, confirmBtn)) {
!EnigConfirm(
confirmMsg,
await document.l10n.formatValue("key-man-button-generate-key")
)
) {
return; return;
} }

Просмотреть файл

@ -2854,11 +2854,12 @@ Enigmail.msg = {
statusFlagsObj.value & EnigmailConstants.UNCERTAIN_SIGNATURE statusFlagsObj.value & EnigmailConstants.UNCERTAIN_SIGNATURE
) { ) {
if (callbackArg.actionType == "openAttachment") { if (callbackArg.actionType == "openAttachment") {
exitStatus = EnigmailDialog.confirmDlg( let [title, button] = await document.l10n.formatValues([
window, { id: "decrypt-ok-no-sig" },
await document.l10n.formatValue("decrypt-ok-no-sig"), { id: "msg-ovl-button-cont-anyway" },
await document.l10n.formatValue("msg-ovl-button-cont-anyway") ]);
);
exitStatus = EnigmailDialog.confirmDlg(window, title, button);
} else { } else {
EnigmailDialog.info( EnigmailDialog.info(
window, window,

Просмотреть файл

@ -2685,12 +2685,11 @@ Enigmail.msg = {
(await document.l10n.formatValue("send-aborted")) + "\n" + txt (await document.l10n.formatValue("send-aborted")) + "\n" + txt
); );
} else { } else {
EnigmailDialog.info( let [title, message] = await document.l10n.formatValues([
window, { id: "send-aborted" },
(await document.l10n.formatValue("send-aborted")) + { id: "msg-compose-internal-error" },
"\n" + ]);
(await document.l10n.formatValue("msg-compose-internal-error")) EnigmailDialog.info(window, title + "\n" + message);
);
} }
}, },
@ -3357,13 +3356,14 @@ Enigmail.msg = {
let buttonArr = []; let buttonArr = [];
if (detailsText && detailsText.length > 0) { if (detailsText && detailsText.length > 0) {
let [accessKey, label] = await document.l10n.formatValues([
{ id: "msg-compose-details-button-access-key" },
{ id: "msg-compose-details-button-label" },
]);
buttonArr.push({ buttonArr.push({
accessKey: await document.l10n.formatValue( accessKey,
"msg-compose-details-button-access-key" label,
),
label: await document.l10n.formatValue(
"msg-compose-details-button-label"
),
callback(aNotificationBar, aButton) { callback(aNotificationBar, aButton) {
EnigmailDialog.info(window, detailsText); EnigmailDialog.info(window, detailsText);
}, },
@ -3377,16 +3377,12 @@ Enigmail.msg = {
* a partially decrypted inline-PGP email * a partially decrypted inline-PGP email
*/ */
async displayPartialEncryptedWarning() { async displayPartialEncryptedWarning() {
let msgLong = await document.l10n.formatValue( let [msgLong, msgShort] = await document.l10n.formatValues([
"msg-compose-partially-encrypted-inlinePGP" { id: "msg-compose-partially-encrypted-inlinePGP" },
); { id: "msg-compose-partially-encrypted-short" },
]);
this.notifyUser( this.notifyUser(1, msgShort, "notifyPartialDecrypt", msgLong);
1,
await document.l10n.formatValue("msg-compose-partially-encrypted-short"),
"notifyPartialDecrypt",
msgLong
);
}, },
editorSelectAll() { editorSelectAll() {

Просмотреть файл

@ -516,10 +516,10 @@ async function openPgpKeygenConfirm() {
* Cancel the keygen process, ask for confirmation before proceeding. * Cancel the keygen process, ask for confirmation before proceeding.
*/ */
async function openPgpKeygenCancel() { async function openPgpKeygenCancel() {
let abortTitle = await document.l10n.formatValue( let [abortTitle, abortText] = await document.l10n.formatValues([
"openpgp-keygen-abort-title" { id: "openpgp-keygen-abort-title" },
); { id: "openpgp-keygen-abort" },
let abortText = await document.l10n.formatValue("openpgp-keygen-abort"); ]);
if ( if (
kGenerating && kGenerating &&