Backed out changeset e579f2ee9cac (bug 1399627) for causing bustage. a=backout

This commit is contained in:
Jorg K 2017-09-21 01:04:14 +02:00
Родитель 4bed7fb430
Коммит c7a34f7002
1 изменённых файлов: 20 добавлений и 17 удалений

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

@ -21,7 +21,6 @@
#include "nsISmtpServer.h"
#include "prtime.h"
#include "mozilla/Logging.h"
#include "nsPrintfCString.h"
#include "prerror.h"
#include "prprf.h"
#include "prmem.h"
@ -72,11 +71,12 @@ using namespace mozilla::mailnews;
///////////////////////////////////////////////////////////////////////////////////////////
/* based on in NET_ExplainErrorDetails in mkmessag.c */
nsresult nsExplainErrorDetails(nsISmtpUrl * aSmtpUrl, nsresult aCode,
const char* arg1, const char* arg2)
nsresult nsExplainErrorDetails(nsISmtpUrl * aSmtpUrl, nsresult aCode, ...)
{
NS_ENSURE_ARG(aSmtpUrl);
va_list args;
nsCOMPtr<nsIPrompt> dialog;
aSmtpUrl->GetPrompt(getter_AddRefs(dialog));
NS_ENSURE_TRUE(dialog, NS_ERROR_FAILURE);
@ -92,6 +92,8 @@ nsresult nsExplainErrorDetails(nsISmtpUrl * aSmtpUrl, nsresult aCode,
getter_AddRefs(bundle));
NS_ENSURE_SUCCESS(rv, rv);
va_start (args, aCode);
const char* exitString;
#ifdef __GNUC__
// Temporary workaroung until bug 783526 is fixed.
@ -102,7 +104,7 @@ nsresult nsExplainErrorDetails(nsISmtpUrl * aSmtpUrl, nsresult aCode,
{
case NS_ERROR_ILLEGAL_LOCALPART:
bundle->GetStringFromName("errorIllegalLocalPart", eMsg);
nsTextFormatter::ssprintf(msg, eMsg.get(), arg1, arg2);
nsTextFormatter::vssprintf(msg, eMsg.get(), args);
break;
case NS_ERROR_SMTP_SERVER_ERROR:
case NS_ERROR_TCP_READ_ERROR:
@ -116,7 +118,7 @@ nsresult nsExplainErrorDetails(nsISmtpUrl * aSmtpUrl, nsresult aCode,
case NS_ERROR_SMTP_GREETING:
exitString = errorStringNameForErrorCode(aCode);
bundle->GetStringFromName(exitString, eMsg);
nsTextFormatter::ssprintf(msg, eMsg.get(), arg1, arg2);
nsTextFormatter::vssprintf(msg, eMsg.get(), args);
break;
default:
NS_WARNING("falling to default error code");
@ -130,6 +132,8 @@ nsresult nsExplainErrorDetails(nsISmtpUrl * aSmtpUrl, nsresult aCode,
rv = dialog->Alert(nullptr, msg.get());
va_end (args);
return rv;
}
@ -372,7 +376,7 @@ nsresult nsSmtpProtocol::Initialize(nsIURI * aURL)
// passed down a compose window - we might be sending in the
// background!
rv = nsExplainErrorDetails(m_runningURL,
NS_ERROR_ILLEGAL_LOCALPART, start, nullptr);
NS_ERROR_ILLEGAL_LOCALPART, start);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to explain illegal localpart");
m_urlErrorState = NS_ERROR_BUT_DONT_SHOW_ALERT;
return NS_ERROR_BUT_DONT_SHOW_ALERT;
@ -667,7 +671,7 @@ nsresult nsSmtpProtocol::ExtensionLoginResponse(nsIInputStream * inputStream, ui
nsresult rv =
#endif
nsExplainErrorDetails(m_runningURL, NS_ERROR_SMTP_GREETING,
m_responseText.get(), nullptr);
m_responseText.get());
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to explain SMTP error");
m_urlErrorState = NS_ERROR_BUT_DONT_SHOW_ALERT;
@ -699,7 +703,7 @@ nsresult nsSmtpProtocol::SendHeloResponse(nsIInputStream * inputStream, uint32_t
rv =
#endif
nsExplainErrorDetails(m_runningURL, NS_ERROR_SMTP_SERVER_ERROR,
m_responseText.get(), nullptr);
m_responseText.get());
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to explain SMTP error");
m_urlErrorState = NS_ERROR_BUT_DONT_SHOW_ALERT;
@ -840,7 +844,7 @@ nsresult nsSmtpProtocol::SendEhloResponse(nsIInputStream * inputStream, uint32_t
nsresult rv =
#endif
nsExplainErrorDetails(m_runningURL, NS_ERROR_SMTP_SERVER_ERROR,
m_responseText.get(), nullptr);
m_responseText.get());
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to explain SMTP error");
m_urlErrorState = NS_ERROR_BUT_DONT_SHOW_ALERT;
@ -924,8 +928,7 @@ nsresult nsSmtpProtocol::SendEhloResponse(nsIInputStream * inputStream, uint32_t
nsresult rv =
#endif
nsExplainErrorDetails(m_runningURL,
NS_ERROR_SMTP_PERM_SIZE_EXCEEDED_1,
nsPrintfCString("%" PRId32, m_sizelimit).get(), nullptr);
NS_ERROR_SMTP_PERM_SIZE_EXCEEDED_1, m_sizelimit);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to explain SMTP error");
m_urlErrorState = NS_ERROR_BUT_DONT_SHOW_ALERT;
@ -1669,7 +1672,7 @@ nsresult nsSmtpProtocol::SendMailResponse()
else
errorcode = NS_ERROR_SENDING_FROM_COMMAND;
rv = nsExplainErrorDetails(m_runningURL, errorcode, m_responseText.get(), nullptr);
rv = nsExplainErrorDetails(m_runningURL, errorcode, m_responseText.get());
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to explain SMTP error");
m_urlErrorState = NS_ERROR_BUT_DONT_SHOW_ALERT;
@ -1770,9 +1773,9 @@ nsresult nsSmtpProtocol::SendRecipientResponse()
errorcode = NS_ERROR_SENDING_RCPT_COMMAND;
if (errorcode == NS_ERROR_SENDING_RCPT_COMMAND) {
rv = nsExplainErrorDetails(m_runningURL, errorcode,
m_responseText.get(),
m_addresses[m_addressesLeft - 1].get());
rv = nsExplainErrorDetails(
m_runningURL, errorcode, NS_ConvertUTF8toUTF16(m_responseText).get(),
NS_ConvertUTF8toUTF16(m_addresses[m_addressesLeft - 1]).get());
} else {
rv = nsExplainErrorDetails(m_runningURL, errorcode,
m_responseText.get(),
@ -1830,7 +1833,7 @@ nsresult nsSmtpProtocol::SendDataResponse()
{
mozilla::DebugOnly<nsresult> rv = nsExplainErrorDetails(m_runningURL,
NS_ERROR_SENDING_DATA_COMMAND,
m_responseText.get(), nullptr);
m_responseText.get());
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to explain SMTP error");
m_urlErrorState = NS_ERROR_BUT_DONT_SHOW_ALERT;
@ -1901,7 +1904,7 @@ nsresult nsSmtpProtocol::SendMessageResponse()
{
mozilla::DebugOnly<nsresult> rv = nsExplainErrorDetails(m_runningURL,
NS_ERROR_SENDING_MESSAGE,
m_responseText.get(), nullptr);
m_responseText.get());
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to explain SMTP error");
m_urlErrorState = NS_ERROR_BUT_DONT_SHOW_ALERT;