Bug 562661 - [@ nsNavHistory::RowToResult] mishandles *aResult, r=mak

This commit is contained in:
timeless@mozdev.org 2010-04-29 19:23:00 -07:00
parent 8290e85f4a
commit 896fb1bb0b

View File

@ -6873,8 +6873,8 @@ nsNavHistory::RowToResult(mozIStorageValueArray* aRow,
nsNavHistoryQueryOptions* aOptions,
nsNavHistoryResultNode** aResult)
{
*aResult = nsnull;
NS_ASSERTION(aRow && aOptions && aResult, "Null pointer in RowToResult");
*aResult = nsnull;
// URL
nsCAutoString url;
@ -6929,20 +6929,18 @@ nsNavHistory::RowToResult(mozIStorageValueArray* aRow,
}
rv = QueryRowToResult(itemId, url, title, accessCount, time, favicon, aResult);
// If it's a simple folder node (i.e. a shortcut to another folder), apply
// our options for it. However, if the parent type was tag query, we do not
// apply them, because it would not yield any results.
if (*aResult && (*aResult)->IsFolder() &&
aOptions->ResultType() !=
nsINavHistoryQueryOptions::RESULTS_AS_TAG_QUERY)
(*aResult)->GetAsContainer()->mOptions = aOptions;
// RESULTS_AS_TAG_QUERY has date columns
NS_ENSURE_STATE(*aResult);
if (aOptions->ResultType() == nsNavHistoryQueryOptions::RESULTS_AS_TAG_QUERY) {
// RESULTS_AS_TAG_QUERY has date columns
(*aResult)->mDateAdded = aRow->AsInt64(kGetInfoIndex_ItemDateAdded);
(*aResult)->mLastModified = aRow->AsInt64(kGetInfoIndex_ItemLastModified);
}
else if ((*aResult)->IsFolder()) {
// If it's a simple folder node (i.e. a shortcut to another folder), apply
// our options for it. However, if the parent type was tag query, we do not
// apply them, because it would not yield any results.
(*aResult)->GetAsContainer()->mOptions = aOptions;
}
return rv;
} else if (aOptions->ResultType() == nsNavHistoryQueryOptions::RESULTS_AS_URI ||