зеркало из 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,
|
||||
const char *headers, PRUint32 headersSize, PRBool *pResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(folder);
|
||||
// use offlineMail because
|
||||
nsMsgSearchScopeTerm* scope = new nsMsgSearchScopeTerm(nsnull, nsMsgSearchScope::offlineMail, folder);
|
||||
if (!scope) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
|
|
@ -299,41 +299,41 @@ nsMsgFilterList::ApplyFiltersToHdr(nsMsgFilterTypeType filterType,
|
|||
nsIMsgFilterHitNotify *listener,
|
||||
nsIMsgWindow *msgWindow)
|
||||
{
|
||||
nsCOMPtr <nsIMsgFilter> filter;
|
||||
PRUint32 filterCount = 0;
|
||||
nsresult rv = GetFilterCount(&filterCount);
|
||||
nsCOMPtr <nsIMsgFilter> filter;
|
||||
PRUint32 filterCount = 0;
|
||||
nsresult rv = GetFilterCount(&filterCount);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
for (PRUint32 filterIndex = 0; filterIndex < filterCount; filterIndex++)
|
||||
{
|
||||
if (NS_SUCCEEDED(GetFilterAt(filterIndex, getter_AddRefs(filter))))
|
||||
{
|
||||
PRBool isEnabled;
|
||||
nsMsgFilterTypeType curFilterType;
|
||||
|
||||
filter->GetEnabled(&isEnabled);
|
||||
if (!isEnabled)
|
||||
continue;
|
||||
|
||||
filter->GetFilterType(&curFilterType);
|
||||
if (curFilterType & filterType)
|
||||
{
|
||||
nsresult matchTermStatus = NS_OK;
|
||||
PRBool result;
|
||||
|
||||
matchTermStatus = filter->MatchHdr(msgHdr, folder, db, headers, headersSize, &result);
|
||||
if (NS_SUCCEEDED(matchTermStatus) && result && listener)
|
||||
{
|
||||
PRBool applyMore = PR_TRUE;
|
||||
|
||||
rv = listener->ApplyFilterHit(filter, msgWindow, &applyMore);
|
||||
if (NS_FAILED(rv) || !applyMore)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
|
||||
for (PRUint32 filterIndex = 0; filterIndex < filterCount; filterIndex++)
|
||||
{
|
||||
if (NS_SUCCEEDED(GetFilterAt(filterIndex, getter_AddRefs(filter))))
|
||||
{
|
||||
PRBool isEnabled;
|
||||
nsMsgFilterTypeType curFilterType;
|
||||
|
||||
filter->GetEnabled(&isEnabled);
|
||||
if (!isEnabled)
|
||||
continue;
|
||||
|
||||
filter->GetFilterType(&curFilterType);
|
||||
if (curFilterType & filterType)
|
||||
{
|
||||
nsresult matchTermStatus = NS_OK;
|
||||
PRBool result;
|
||||
|
||||
matchTermStatus = filter->MatchHdr(msgHdr, folder, db, headers, headersSize, &result);
|
||||
if (NS_SUCCEEDED(matchTermStatus) && result && listener)
|
||||
{
|
||||
PRBool applyMore = PR_TRUE;
|
||||
|
||||
rv = listener->ApplyFilterHit(filter, msgWindow, &applyMore);
|
||||
if (NS_FAILED(rv) || !applyMore)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -380,8 +380,8 @@ nsMsgFilterList::SaveToDefaultFile()
|
|||
|
||||
typedef struct
|
||||
{
|
||||
nsMsgFilterFileAttribValue attrib;
|
||||
const char *attribName;
|
||||
nsMsgFilterFileAttribValue attrib;
|
||||
const char *attribName;
|
||||
} FilterFileAttribEntry;
|
||||
|
||||
static FilterFileAttribEntry FilterFileAttribTable[] =
|
||||
|
|
Загрузка…
Ссылка в новой задаче