diff --git a/toolkit/components/places/nsNavBookmarks.h b/toolkit/components/places/nsNavBookmarks.h index bb40309d137..a1a87f2e26e 100644 --- a/toolkit/components/places/nsNavBookmarks.h +++ b/toolkit/components/places/nsNavBookmarks.h @@ -210,11 +210,6 @@ public: nsresult GetDescendantFolders(int64_t aFolderId, nsTArray& aDescendantFoldersArray); - static const int32_t kGetChildrenIndex_Guid; - static const int32_t kGetChildrenIndex_Position; - static const int32_t kGetChildrenIndex_Type; - static const int32_t kGetChildrenIndex_PlaceID; - private: static nsNavBookmarks* gBookmarksService; @@ -361,6 +356,11 @@ private: int64_t RecursiveFindRedirectedBookmark(int64_t aPlaceId); + static const int32_t kGetChildrenIndex_Position; + static const int32_t kGetChildrenIndex_Type; + static const int32_t kGetChildrenIndex_PlaceID; + static const int32_t kGetChildrenIndex_Guid; + class RemoveFolderTransaction MOZ_FINAL : public nsITransaction { public: explicit RemoveFolderTransaction(int64_t aID) : mID(aID) {} diff --git a/toolkit/components/places/nsNavHistory.cpp b/toolkit/components/places/nsNavHistory.cpp index 76ffb8d9e8e..8a977b62119 100644 --- a/toolkit/components/places/nsNavHistory.cpp +++ b/toolkit/components/places/nsNavHistory.cpp @@ -1512,8 +1512,7 @@ PlacesSQLQueryBuilder::SelectAsURI() "SELECT b2.fk, h.url, COALESCE(b2.title, h.title) AS page_title, " "h.rev_host, h.visit_count, h.last_visit_date, f.url, b2.id, " "b2.dateAdded, b2.lastModified, b2.parent, ") + - tagsSqlFragment + NS_LITERAL_CSTRING(", h.frecency, h.hidden, h.guid, " - "b2.guid, b2.position, b2.type, b2.fk " + tagsSqlFragment + NS_LITERAL_CSTRING(", h.frecency, h.hidden, h.guid " "FROM moz_bookmarks b2 " "JOIN (SELECT b.fk " "FROM moz_bookmarks b " @@ -1537,8 +1536,7 @@ PlacesSQLQueryBuilder::SelectAsURI() "SELECT b.fk, h.url, COALESCE(b.title, h.title) AS page_title, " "h.rev_host, h.visit_count, h.last_visit_date, f.url, b.id, " "b.dateAdded, b.lastModified, b.parent, ") + - tagsSqlFragment + NS_LITERAL_CSTRING(", h.frecency, h.hidden, h.guid," - "b.guid, b.position, b.type, b.fk " + tagsSqlFragment + NS_LITERAL_CSTRING(", h.frecency, h.hidden, h.guid " "FROM moz_bookmarks b " "JOIN moz_places h ON b.fk = h.id " "LEFT OUTER JOIN moz_favicons f ON h.favicon_id = f.id " @@ -3904,40 +3902,36 @@ nsNavHistory::RowToResult(mozIStorageValueArray* aRow, } if (IsQueryURI(url)) { - // Special case "place:" URIs: turn them into containers. + // special case "place:" URIs: turn them into containers + + // We should never expose the history title for query nodes if the + // bookmark-item's title is set to null (the history title may be the + // query string without the place: prefix). Thus we call getItemTitle + // explicitly. Doing this in the SQL query would be less performant since + // it should be done for all results rather than only for queries. + if (itemId != -1) { + nsNavBookmarks *bookmarks = nsNavBookmarks::GetBookmarksService(); + NS_ENSURE_TRUE(bookmarks, NS_ERROR_OUT_OF_MEMORY); + + rv = bookmarks->GetItemTitle(itemId, title); + NS_ENSURE_SUCCESS(rv, rv); + } + nsRefPtr resultNode; rv = QueryRowToResult(itemId, url, title, accessCount, time, favicon, getter_AddRefs(resultNode)); NS_ENSURE_SUCCESS(rv,rv); - if (itemId != -1) { - rv = aRow->GetUTF8String(nsNavBookmarks::kGetChildrenIndex_Guid, - resultNode->mBookmarkGuid); - NS_ENSURE_SUCCESS(rv, rv); - - // We should never expose the history title for query nodes if the - // bookmark-item's title is set to null (the history title may be the - // query string without the place: prefix). Thus we call getItemTitle - // explicitly. Doing this in the SQL query would be less performant since - // it should be done for all results rather than only for queries. - nsNavBookmarks *bookmarks = nsNavBookmarks::GetBookmarksService(); - NS_ENSURE_TRUE(bookmarks, NS_ERROR_OUT_OF_MEMORY); - - rv = bookmarks->GetItemTitle(itemId, resultNode->mTitle); - NS_ENSURE_SUCCESS(rv, rv); - } - - if (itemId != -1 || - aOptions->ResultType() == nsNavHistoryQueryOptions::RESULTS_AS_TAG_QUERY) { + if (aOptions->ResultType() == nsNavHistoryQueryOptions::RESULTS_AS_TAG_QUERY) { // RESULTS_AS_TAG_QUERY has date columns resultNode->mDateAdded = aRow->AsInt64(kGetInfoIndex_ItemDateAdded); resultNode->mLastModified = aRow->AsInt64(kGetInfoIndex_ItemLastModified); - if (resultNode->IsFolder()) { - // If it's a simple folder node (i.e. a shortcut to another folder), apply - // our options for it. However, if the parent type was tag query, we do not - // apply them, because it would not yield any results. - resultNode->GetAsContainer()->mOptions = aOptions; - } + } + else if (resultNode->IsFolder()) { + // If it's a simple folder node (i.e. a shortcut to another folder), apply + // our options for it. However, if the parent type was tag query, we do not + // apply them, because it would not yield any results. + resultNode->GetAsContainer()->mOptions = aOptions; } resultNode.forget(aResult); @@ -3952,10 +3946,6 @@ nsNavHistory::RowToResult(mozIStorageValueArray* aRow, resultNode->mFolderId = parentId; resultNode->mDateAdded = aRow->AsInt64(kGetInfoIndex_ItemDateAdded); resultNode->mLastModified = aRow->AsInt64(kGetInfoIndex_ItemLastModified); - - rv = aRow->GetUTF8String(nsNavBookmarks::kGetChildrenIndex_Guid, - resultNode->mBookmarkGuid); - NS_ENSURE_SUCCESS(rv, rv); } resultNode->mFrecency = aRow->AsInt32(kGetInfoIndex_Frecency); @@ -4145,8 +4135,7 @@ nsNavHistory::BookmarkIdToResultNode(int64_t aBookmarkId, nsNavHistoryQueryOptio "SELECT b.fk, h.url, COALESCE(b.title, h.title), " "h.rev_host, h.visit_count, h.last_visit_date, f.url, b.id, " "b.dateAdded, b.lastModified, b.parent, " - ) + tagsFragment + NS_LITERAL_CSTRING(", h.frecency, h.hidden, h.guid, " - "b.guid, b.position, b.type, b.fk " + ) + tagsFragment + NS_LITERAL_CSTRING(", h.frecency, h.hidden, h.guid " "FROM moz_bookmarks b " "JOIN moz_places h ON b.fk = h.id " "LEFT JOIN moz_favicons f ON h.favicon_id = f.id " diff --git a/toolkit/components/places/nsNavHistoryResult.cpp b/toolkit/components/places/nsNavHistoryResult.cpp index 1d90b77ca1b..c93cd6f95f3 100644 --- a/toolkit/components/places/nsNavHistoryResult.cpp +++ b/toolkit/components/places/nsNavHistoryResult.cpp @@ -3584,9 +3584,6 @@ nsNavHistoryFolderResultNode::OnItemAdded(int64_t aItemId, node = new nsNavHistorySeparatorResultNode(); NS_ENSURE_TRUE(node, NS_ERROR_OUT_OF_MEMORY); node->mItemId = aItemId; - node->mBookmarkGuid = aGUID; - node->mDateAdded = aDateAdded; - node->mLastModified = aDateAdded; } node->mBookmarkIndex = aIndex; diff --git a/toolkit/components/places/tests/unit/xpcshell.ini b/toolkit/components/places/tests/unit/xpcshell.ini index ebe9ed78b31..a887da9f184 100644 --- a/toolkit/components/places/tests/unit/xpcshell.ini +++ b/toolkit/components/places/tests/unit/xpcshell.ini @@ -55,7 +55,6 @@ skip-if = os == "android" [test_485442_crash_bug_nsNavHistoryQuery_GetUri.js] [test_486978_sort_by_date_queries.js] [test_536081.js] -[test_1085291.js] [test_adaptive.js] # Bug 676989: test hangs consistently on Android skip-if = os == "android"