Bug 1395333 - Remove an unexpected warning from nsNavHistoryResult.cpp. r=standard8 draft
authorMarco Bonardo <mbonardo@mozilla.com>
Fri, 01 Sep 2017 13:55:01 +0200
changeset 657412 454ce521443bcb07f74592271f79da58dae326d4
parent 657343 a3585c77e2b1bc5f5fea907e97762f7b47a12033
child 729419 d6e66691248c9c9736a53ba37b8d5f0792aac1da
push id77511
push usermak77@bonardo.net
push dateFri, 01 Sep 2017 12:01:03 +0000
reviewersstandard8
bugs1395333
milestone57.0a1
Bug 1395333 - Remove an unexpected warning from nsNavHistoryResult.cpp. r=standard8 MozReview-Commit-ID: 1Ba2Nwvs0FB
toolkit/components/places/nsNavHistoryResult.cpp
--- 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));
   }