Bug 1773672 - Show error when recipient has non-ascii local part but server has no SMTPUTF8 capability. r=mkmelin

Differential Revision: https://phabricator.services.mozilla.com/D149198

--HG--
extra : absorb_source : c23977e3dc06d0c5995990661241f7b3cdff5e75
This commit is contained in:
Ping Chen 2022-06-14 06:37:03 +00:00
Родитель 54316086fb
Коммит 85713d148a
3 изменённых файлов: 10 добавлений и 10 удалений

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

@ -335,17 +335,18 @@ MessageSend.prototype = {
MsgUtils.sendLogger.error(
`Sending failed; ${errorMsg}, exitCode=${exitCode}, originalMsgURI=${this._originalMsgURI}`
);
this._sendReport.setError(
Ci.nsIMsgSendReport.process_Current,
exitCode,
false
);
if (errorMsg) {
this._sendReport.setMessage(
Ci.nsIMsgSendReport.process_Current,
errorMsg,
false
);
} else {
this._sendReport.setError(
Ci.nsIMsgSendReport.process_Current,
exitCode,
false
);
}
exitCode = this._sendReport.displayReport(prompt, true, true);
}

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

@ -42,8 +42,6 @@ var { MsgUtils } = ChromeUtils.import(
"resource:///modules/MimeMessageUtils.jsm"
);
const NS_ERROR_BUT_DONT_SHOW_ALERT = 0x805530ef;
class SmtpClient {
/**
* Creates a connection object to a SMTP server and allows to send mail through it.
@ -200,7 +198,7 @@ class SmtpClient {
if (!recipient || firstInvalid != null) {
if (!lastAt) {
// Invalid char found in the localpart, throw error until we implement RFC 6532.
this.onerror(NS_ERROR_BUT_DONT_SHOW_ALERT, null);
this._onNsError(MsgUtils.NS_ERROR_ILLEGAL_LOCALPART, recipient);
return;
}
// Invalid char found in the domainpart, convert it to ACE.
@ -468,6 +466,7 @@ class SmtpClient {
MsgUtils.NS_ERROR_SENDING_RCPT_COMMAND,
MsgUtils.NS_ERROR_SENDING_DATA_COMMAND,
MsgUtils.NS_ERROR_SENDING_MESSAGE,
MsgUtils.NS_ERROR_ILLEGAL_LOCALPART,
].includes(nsError)
) {
let bundle = Services.strings.createBundle(

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

@ -17,7 +17,7 @@ var kToValid = "to@v\u00E4lid.foo.invalid";
var kToValidACE = "to@xn--vlid-loa.foo.invalid";
var kToInvalid = "b\u00F8rken.to@invalid.foo.invalid";
var kToInvalidWithoutDomain = "b\u00F8rken.to";
var NS_ERROR_BUT_DONT_SHOW_ALERT = 0x805530ef;
var NS_ERROR_ILLEGAL_LOCALPART = 0x80553139;
/* exported alert */
// for alertTestUtils.js
@ -70,7 +70,7 @@ MsgSendListener.prototype = {
// Compare data file to what the server received
Assert.equal(this.originalData, server._daemon.post);
} else {
Assert.equal(aStatus, NS_ERROR_BUT_DONT_SHOW_ALERT);
Assert.equal(aStatus, NS_ERROR_ILLEGAL_LOCALPART);
do_check_transaction(server.playTransaction(), ["EHLO test"]);
// Local address (before the @) has non-ascii char(s) or the @ is
// missing from the address. An alert is triggered after the EHLO is