Bug 1395333 - Remove an unexpected warning from nsNavHistoryResult.cpp. r=standard8
MozReview-Commit-ID: 1Ba2Nwvs0FB
--- a/toolkit/components/places/nsNavHistoryResult.cpp
+++ b/toolkit/components/places/nsNavHistoryResult.cpp
@@ -2455,17 +2455,20 @@ nsNavHistoryQueryResultNode::OnVisit(nsI
return NS_OK;
// The history service can tell us whether the new item should appear
// in the result. We first have to construct a node for it to check.
RefPtr<nsNavHistoryResultNode> addition;
nsresult rv = history->VisitIdToResultNode(aVisitId, mOptions,
getter_AddRefs(addition));
NS_ENSURE_SUCCESS(rv, rv);
- NS_ENSURE_STATE(addition);
+ if (!addition) {
+ // Certain result types manage the nodes by themselves.
+ return NS_OK;
+ }
addition->mTransitionType = aTransitionType;
if (!history->EvaluateQueryForNode(mQueries, mOptions, addition))
return NS_OK; // don't need to include in our query
if (mOptions->ResultType() == nsNavHistoryQueryOptions::RESULTS_AS_VISIT) {
// If this is a visit type query, just insert the new visit. We never
// update visits, only add or remove them.
rv = InsertSortedChild(addition);
@@ -3849,17 +3852,20 @@ nsNavHistoryFolderResultNode::OnItemVisi
// TODO (bug 832617): we may avoid one query here, by providing the new
// frecency value in the notification.
nsNavHistory* history = nsNavHistory::GetHistoryService();
NS_ENSURE_TRUE(history, NS_OK);
RefPtr<nsNavHistoryResultNode> visitNode;
rv = history->VisitIdToResultNode(aVisitId, mOptions,
getter_AddRefs(visitNode));
NS_ENSURE_SUCCESS(rv, rv);
- NS_ENSURE_STATE(visitNode);
+ if (!visitNode) {
+ // Certain result types manage the nodes by themselves.
+ return NS_OK;
+ }
node->mFrecency = visitNode->mFrecency;
if (AreChildrenVisible()) {
// Sorting has not changed, just redraw the row if it's visible.
nsNavHistoryResult* result = GetResult();
NOTIFY_RESULT_OBSERVERS(result,
NodeHistoryDetailsChanged(node, nodeOldTime, nodeOldAccessCount));
}