Bug 1395333 - Remove an unexpected warning from nsNavHistoryResult.cpp. r=standard8
authorMarco Bonardo <mbonardo@mozilla.com>
Fri, 01 Sep 2017 13:55:01 +0200
changeset 428233 d8a45e6819f5f12abd7e4bdec94030a8e7a88f2a
parent 428232 15cfcee45b87afce49e31eed12c11474e4a7b38d
child 428234 cc1dd06b768883dd5d66b1486558a98f69c4fdff
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstandard8
bugs1395333
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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));
   }