зеркало из https://github.com/mozilla/pjs.git
fix crash in nsMsgFilter::MatchHdr with null folder, check for null folder, r/sr=mscott 218885 and whitespace cleanup
This commit is contained in:
Родитель
33dafeb6d1
Коммит
7bd9c6323b
|
@ -434,6 +434,7 @@ NS_IMETHODIMP nsMsgFilter::LogRuleHit(nsIMsgRuleAction *aFilterAction, nsIMsgDBH
|
||||||
NS_IMETHODIMP nsMsgFilter::MatchHdr(nsIMsgDBHdr *msgHdr, nsIMsgFolder *folder, nsIMsgDatabase *db,
|
NS_IMETHODIMP nsMsgFilter::MatchHdr(nsIMsgDBHdr *msgHdr, nsIMsgFolder *folder, nsIMsgDatabase *db,
|
||||||
const char *headers, PRUint32 headersSize, PRBool *pResult)
|
const char *headers, PRUint32 headersSize, PRBool *pResult)
|
||||||
{
|
{
|
||||||
|
NS_ENSURE_ARG_POINTER(folder);
|
||||||
// use offlineMail because
|
// use offlineMail because
|
||||||
nsMsgSearchScopeTerm* scope = new nsMsgSearchScopeTerm(nsnull, nsMsgSearchScope::offlineMail, folder);
|
nsMsgSearchScopeTerm* scope = new nsMsgSearchScopeTerm(nsnull, nsMsgSearchScope::offlineMail, folder);
|
||||||
if (!scope) return NS_ERROR_OUT_OF_MEMORY;
|
if (!scope) return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
|
@ -299,41 +299,41 @@ nsMsgFilterList::ApplyFiltersToHdr(nsMsgFilterTypeType filterType,
|
||||||
nsIMsgFilterHitNotify *listener,
|
nsIMsgFilterHitNotify *listener,
|
||||||
nsIMsgWindow *msgWindow)
|
nsIMsgWindow *msgWindow)
|
||||||
{
|
{
|
||||||
nsCOMPtr <nsIMsgFilter> filter;
|
nsCOMPtr <nsIMsgFilter> filter;
|
||||||
PRUint32 filterCount = 0;
|
PRUint32 filterCount = 0;
|
||||||
nsresult rv = GetFilterCount(&filterCount);
|
nsresult rv = GetFilterCount(&filterCount);
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
for (PRUint32 filterIndex = 0; filterIndex < filterCount; filterIndex++)
|
for (PRUint32 filterIndex = 0; filterIndex < filterCount; filterIndex++)
|
||||||
{
|
{
|
||||||
if (NS_SUCCEEDED(GetFilterAt(filterIndex, getter_AddRefs(filter))))
|
if (NS_SUCCEEDED(GetFilterAt(filterIndex, getter_AddRefs(filter))))
|
||||||
{
|
{
|
||||||
PRBool isEnabled;
|
PRBool isEnabled;
|
||||||
nsMsgFilterTypeType curFilterType;
|
nsMsgFilterTypeType curFilterType;
|
||||||
|
|
||||||
filter->GetEnabled(&isEnabled);
|
filter->GetEnabled(&isEnabled);
|
||||||
if (!isEnabled)
|
if (!isEnabled)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
filter->GetFilterType(&curFilterType);
|
filter->GetFilterType(&curFilterType);
|
||||||
if (curFilterType & filterType)
|
if (curFilterType & filterType)
|
||||||
{
|
{
|
||||||
nsresult matchTermStatus = NS_OK;
|
nsresult matchTermStatus = NS_OK;
|
||||||
PRBool result;
|
PRBool result;
|
||||||
|
|
||||||
matchTermStatus = filter->MatchHdr(msgHdr, folder, db, headers, headersSize, &result);
|
matchTermStatus = filter->MatchHdr(msgHdr, folder, db, headers, headersSize, &result);
|
||||||
if (NS_SUCCEEDED(matchTermStatus) && result && listener)
|
if (NS_SUCCEEDED(matchTermStatus) && result && listener)
|
||||||
{
|
{
|
||||||
PRBool applyMore = PR_TRUE;
|
PRBool applyMore = PR_TRUE;
|
||||||
|
|
||||||
rv = listener->ApplyFilterHit(filter, msgWindow, &applyMore);
|
rv = listener->ApplyFilterHit(filter, msgWindow, &applyMore);
|
||||||
if (NS_FAILED(rv) || !applyMore)
|
if (NS_FAILED(rv) || !applyMore)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -380,8 +380,8 @@ nsMsgFilterList::SaveToDefaultFile()
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
nsMsgFilterFileAttribValue attrib;
|
nsMsgFilterFileAttribValue attrib;
|
||||||
const char *attribName;
|
const char *attribName;
|
||||||
} FilterFileAttribEntry;
|
} FilterFileAttribEntry;
|
||||||
|
|
||||||
static FilterFileAttribEntry FilterFileAttribTable[] =
|
static FilterFileAttribEntry FilterFileAttribTable[] =
|
||||||
|
|
Загрузка…
Ссылка в новой задаче