зеркало из https://github.com/mozilla/pjs.git
fix for #75973. prevent the crash when a user entered a bogus hostname
in the account wizard. and now, prevent the user from entering a bogus hostname. the test isn't perfect yet, but it's much better. r=racham,sr=bienvenu
This commit is contained in:
Родитель
b58a562aee
Коммит
d1ddcbffaf
|
@ -38,7 +38,7 @@ Rights Reserved.
|
|||
<box class="box-header" title="&serverTitle.label;"/>
|
||||
|
||||
<separator/>
|
||||
|
||||
|
||||
<box class="box-wizardcontent" orient="vertical" flex="1">
|
||||
|
||||
<html>&newsServerNameDesc.label;</html>
|
||||
|
|
|
@ -24,12 +24,27 @@
|
|||
|
||||
var gPrefsBundle;
|
||||
|
||||
function validate() {
|
||||
function hostnameIsIllegal(hostname)
|
||||
{
|
||||
// XXX TODO do a complete check.
|
||||
// this only checks for illegal characters in the hostname
|
||||
// but hostnames like "...." and "_" and ".111" will get by
|
||||
// my test.
|
||||
var validChars = hostname.match(/[A-Za-z0-9._]/g);
|
||||
if (!validChars || (validChars.length != hostname.length)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function validate()
|
||||
{
|
||||
var servername = document.getElementById("hostname");
|
||||
var smtpserver = document.getElementById("smtphostname");
|
||||
|
||||
if ((servername && servername.value =="") ||
|
||||
(smtpserver && smtpserver.value == "")) {
|
||||
if ((servername && hostnameIsIllegal(servername.value)) ||
|
||||
(smtpserver && hostnameIsIllegal(smtpserver.value))) {
|
||||
var alertText = gPrefsBundle.getString("enterValidHostname");
|
||||
window.alert(alertText);
|
||||
return false;
|
||||
|
|
|
@ -1618,22 +1618,23 @@ nsMsgNewsFolder::GetAsciiName(char **asciiName)
|
|||
NS_IMETHODIMP
|
||||
nsMsgNewsFolder::GetNntpServer(nsINntpIncomingServer **result)
|
||||
{
|
||||
nsresult rv;
|
||||
if (!result) return NS_ERROR_NULL_POINTER;
|
||||
nsresult rv;
|
||||
NS_ENSURE_ARG_POINTER(result);
|
||||
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
rv = GetServer(getter_AddRefs(server));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!server) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsINntpIncomingServer> nntpServer;
|
||||
rv = server->QueryInterface(NS_GET_IID(nsINntpIncomingServer),
|
||||
getter_AddRefs(nntpServer));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = nntpServer;
|
||||
NS_IF_ADDREF(*result);
|
||||
*result = nntpServer;
|
||||
NS_IF_ADDREF(*result);
|
||||
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// this gets called after the message actually gets cancelled
|
||||
|
|
Загрузка…
Ссылка в новой задаче