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-error";
let messageElement = document.getElementById("calendar-ics-file-dialog-message");
messageElement.value = await document.l10n.formatValue(messageIdentifier);
let [msgValue, btnLabel] = await document.l10n.formatValues([
{ 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;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -604,12 +604,23 @@ async function enigmailExportKeys() {
var exportSecretKey = false;
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
var r = EnigmailDialog.msgBox(window, {
msgtext: await document.l10n.formatValue("export-secret-key"),
dialogTitle: await document.l10n.formatValue("enig-confirm"),
button1: await document.l10n.formatValue("key-man-button-export-pub-key"),
button2: await document.l10n.formatValue("key-man-button-export-sec-key"),
msgtext,
dialogTitle,
button1,
button2,
cancelButton: ":cancel",
iconType: EnigmailConstants.ICONTYPE_QUESTION,
});

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

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

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

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

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

@ -1493,9 +1493,9 @@ Enigmail.msg = {
// 4: attach own key
// 5: subject encrypted
var draftStatus = "N" +
(gSendEncrypted && !gOptionalEncryption) +
(gSendSigned) +
var draftStatus = "N" +
(gSendEncrypted && !gOptionalEncryption) +
(gSendSigned) +
(gAttachMyPublicPGPKey ? "1" : "0") + (doEncrypt && this.protectHeaders ? "1" : "0");
this.setAdditionalHeader("X-Enigmail-Draft-Status", draftStatus);
@ -2685,12 +2685,11 @@ Enigmail.msg = {
(await document.l10n.formatValue("send-aborted")) + "\n" + txt
);
} else {
EnigmailDialog.info(
window,
(await document.l10n.formatValue("send-aborted")) +
"\n" +
(await document.l10n.formatValue("msg-compose-internal-error"))
);
let [title, message] = await document.l10n.formatValues([
{ id: "send-aborted" },
{ id: "msg-compose-internal-error" },
]);
EnigmailDialog.info(window, title + "\n" + message);
}
},
@ -3357,13 +3356,14 @@ Enigmail.msg = {
let buttonArr = [];
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({
accessKey: await document.l10n.formatValue(
"msg-compose-details-button-access-key"
),
label: await document.l10n.formatValue(
"msg-compose-details-button-label"
),
accessKey,
label,
callback(aNotificationBar, aButton) {
EnigmailDialog.info(window, detailsText);
},
@ -3377,16 +3377,12 @@ Enigmail.msg = {
* a partially decrypted inline-PGP email
*/
async displayPartialEncryptedWarning() {
let msgLong = await document.l10n.formatValue(
"msg-compose-partially-encrypted-inlinePGP"
);
let [msgLong, msgShort] = await document.l10n.formatValues([
{ id: "msg-compose-partially-encrypted-inlinePGP" },
{ id: "msg-compose-partially-encrypted-short" },
]);
this.notifyUser(
1,
await document.l10n.formatValue("msg-compose-partially-encrypted-short"),
"notifyPartialDecrypt",
msgLong
);
this.notifyUser(1, msgShort, "notifyPartialDecrypt", msgLong);
},
editorSelectAll() {

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

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