Bug 707953 - ProcessFolderNodeRow should reuse known data.
authorMarco Bonardo <mbonardo@mozilla.com>
Wed, 07 Dec 2011 21:56:21 +0100
changeset 82194 a0daa1a39a20f92ccecb4c0f92dcc302070b7f48
parent 82193 7a4205ac809e6e934a2eb7ec341ce7f5f1881886
child 82195 a3d66acea00353ae7a9bf88bb4315382aa8d56ab
push id3900
push usermak77@bonardo.net
push dateWed, 07 Dec 2011 20:57:16 +0000
treeherdermozilla-inbound@ae823406bcb3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs707953
milestone11.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 707953 - ProcessFolderNodeRow should reuse known data. r=dietrich
toolkit/components/places/nsNavBookmarks.cpp
--- a/toolkit/components/places/nsNavBookmarks.cpp
+++ b/toolkit/components/places/nsNavBookmarks.cpp
@@ -2011,17 +2011,19 @@ nsNavBookmarks::ProcessFolderNodeRow(
   aCurrentIndex++;
 
   PRInt32 itemType;
   nsresult rv = aRow->GetInt32(kGetChildrenIndex_Type, &itemType);
   NS_ENSURE_SUCCESS(rv, rv);
   PRInt64 id;
   rv = aRow->GetInt64(nsNavHistory::kGetInfoIndex_ItemId, &id);
   NS_ENSURE_SUCCESS(rv, rv);
+
   nsRefPtr<nsNavHistoryResultNode> node;
+
   if (itemType == TYPE_BOOKMARK) {
     nsNavHistory* history = nsNavHistory::GetHistoryService();
     NS_ENSURE_TRUE(history, NS_ERROR_OUT_OF_MEMORY);
     rv = history->RowToResult(aRow, aOptions, getter_AddRefs(node));
     NS_ENSURE_SUCCESS(rv, rv);
 
     PRUint32 nodeType;
     node->GetType(&nodeType);
@@ -2036,29 +2038,38 @@ nsNavBookmarks::ProcessFolderNodeRow(
   else if (itemType == TYPE_FOLDER) {
     if (aOptions->ExcludeReadOnlyFolders()) {
       // If the folder is read-only, skip it.
       bool readOnly = false;
       GetFolderReadonly(id, &readOnly);
       if (readOnly)
         return NS_OK;
     }
-    rv = ResultNodeForContainer(id, aOptions, getter_AddRefs(node));
+
+    nsCAutoString title;
+    rv = aRow->GetUTF8String(nsNavHistory::kGetInfoIndex_Title, title);
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    node = new nsNavHistoryFolderResultNode(title, aOptions, id);
+
+    rv = aRow->GetInt64(nsNavHistory::kGetInfoIndex_ItemDateAdded,
+                        &node->mDateAdded);
+    NS_ENSURE_SUCCESS(rv, rv);
+    rv = aRow->GetInt64(nsNavHistory::kGetInfoIndex_ItemLastModified,
+                        &node->mLastModified);
     NS_ENSURE_SUCCESS(rv, rv);
   }
   else {
     // This is a separator.
     if (aOptions->ExcludeItems()) {
       return NS_OK;
     }
     node = new nsNavHistorySeparatorResultNode();
-    NS_ENSURE_TRUE(node, NS_ERROR_OUT_OF_MEMORY);
-
-    rv = aRow->GetInt64(nsNavHistory::kGetInfoIndex_ItemId, &node->mItemId);
-    NS_ENSURE_SUCCESS(rv, rv);
+
+    node->mItemId = id;
     rv = aRow->GetInt64(nsNavHistory::kGetInfoIndex_ItemDateAdded,
                         &node->mDateAdded);
     NS_ENSURE_SUCCESS(rv, rv);
     rv = aRow->GetInt64(nsNavHistory::kGetInfoIndex_ItemLastModified,
                         &node->mLastModified);
     NS_ENSURE_SUCCESS(rv, rv);
   }