Bug 830423 part 2 - Avoid history view refreshes when onvisit falls into the Today bucket.

r=Mano
This commit is contained in:
Marco Bonardo 2013-03-18 16:09:11 +01:00
parent 601c09ba3a
commit 4b6f455e23

View File

@ -4630,16 +4630,27 @@ nsNavHistoryResult::OnVisit(nsIURI* aURI, int64_t aVisitId, PRTime aTime,
// that a matching query either was not expanded or it does not exist.
uint32_t resultType = mRootNode->mOptions->ResultType();
if (resultType == nsINavHistoryQueryOptions::RESULTS_AS_DATE_QUERY ||
resultType == nsINavHistoryQueryOptions::RESULTS_AS_DATE_SITE_QUERY ||
resultType == nsINavHistoryQueryOptions::RESULTS_AS_SITE_QUERY)
(void)mRootNode->GetAsQuery()->Refresh();
else {
// We are result of a folder node, then we should run through history
// observers that are containers queries and refresh them.
// We use a copy of the observers array since requerying could potentially
// cause changes to the array.
ENUMERATE_QUERY_OBSERVERS(Refresh(), mHistoryObservers, IsContainersQuery());
resultType == nsINavHistoryQueryOptions::RESULTS_AS_DATE_SITE_QUERY) {
// If the visit falls into the Today bucket and the bucket exists, it was
// just not expanded, thus there's no reason to update.
int64_t beginOfToday =
nsNavHistory::NormalizeTime(nsINavHistoryQuery::TIME_RELATIVE_TODAY, 0);
if (todayIsMissing || aTime < beginOfToday) {
(void)mRootNode->GetAsQuery()->Refresh();
}
return NS_OK;
}
if (resultType == nsINavHistoryQueryOptions::RESULTS_AS_SITE_QUERY) {
(void)mRootNode->GetAsQuery()->Refresh();
return NS_OK;
}
// We are result of a folder node, then we should run through history
// observers that are containers queries and refresh them.
// We use a copy of the observers array since requerying could potentially
// cause changes to the array.
ENUMERATE_QUERY_OBSERVERS(Refresh(), mHistoryObservers, IsContainersQuery());
}
return NS_OK;