Bug 1832698 - Stop nsMsgQuickSearchDBView::OnSearchDone discarding valid results. r=babolivier
The block after this line is comparing a descending list of keys against an ascending list of keys, deciding they are different, and throwing them all out. Differential Revision: https://phabricator.services.mozilla.com/D181173 --HG-- extra : rebase_source : a7e752371a88a41500233b4acd1a0b717719e8c1
This commit is contained in:
Родитель
a38b392d0f
Коммит
d5bc30f848
|
@ -300,27 +300,26 @@ nsMsgQuickSearchDBView::OnSearchDone(nsresult status) {
|
|||
nsCString searchUri;
|
||||
m_viewFolder->GetURI(searchUri);
|
||||
uint32_t count = m_hdrHits.Count();
|
||||
// Build up message keys. The hits are in descending order but the cache
|
||||
// expects them to be in ascending key order.
|
||||
for (uint32_t i = count; i > 0; i--) {
|
||||
// Build up message keys. The cache expects them to be sorted.
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
nsMsgKey key;
|
||||
m_hdrHits[i - 1]->GetMessageKey(&key);
|
||||
m_hdrHits[i]->GetMessageKey(&key);
|
||||
keyArray.AppendElement(key);
|
||||
}
|
||||
if (m_db) {
|
||||
nsTArray<nsMsgKey> staleHits;
|
||||
nsresult rv = m_db->RefreshCache(searchUri, keyArray, staleHits);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
for (nsMsgKey staleKey : staleHits) {
|
||||
nsCOMPtr<nsIMsgDBHdr> hdrDeleted;
|
||||
m_db->GetMsgHdrForKey(staleKey, getter_AddRefs(hdrDeleted));
|
||||
if (hdrDeleted) OnHdrDeleted(hdrDeleted, nsMsgKey_None, 0, this);
|
||||
}
|
||||
keyArray.Sort();
|
||||
nsTArray<nsMsgKey> staleHits;
|
||||
nsresult rv = m_db->RefreshCache(searchUri, keyArray, staleHits);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
for (nsMsgKey staleKey : staleHits) {
|
||||
nsCOMPtr<nsIMsgDBHdr> hdrDeleted;
|
||||
m_db->GetMsgHdrForKey(staleKey, getter_AddRefs(hdrDeleted));
|
||||
if (hdrDeleted) OnHdrDeleted(hdrDeleted, nsMsgKey_None, 0, this);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIMsgDatabase> virtDatabase;
|
||||
nsCOMPtr<nsIDBFolderInfo> dbFolderInfo;
|
||||
nsresult rv = m_viewFolder->GetDBFolderInfoAndDB(
|
||||
getter_AddRefs(dbFolderInfo), getter_AddRefs(virtDatabase));
|
||||
rv = m_viewFolder->GetDBFolderInfoAndDB(getter_AddRefs(dbFolderInfo),
|
||||
getter_AddRefs(virtDatabase));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
uint32_t numUnread = 0;
|
||||
size_t numTotal = m_origKeys.Length();
|
||||
|
|
|
@ -4599,7 +4599,14 @@ NS_IMETHODIMP nsMsgDatabase::RefreshCache(const nsACString& aSearchFolderUri,
|
|||
uint32_t rowCount;
|
||||
table->GetCount(GetEnv(), &rowCount);
|
||||
aStaleHits.Clear();
|
||||
// should assert that each array is sorted
|
||||
|
||||
#ifdef DEBUG
|
||||
for (uint64_t i = 1; i < aNewHits.Length(); i++) {
|
||||
NS_ASSERTION(aNewHits[i - 1] < aNewHits[i],
|
||||
"cached hits for storage not sorted correctly");
|
||||
}
|
||||
#endif
|
||||
|
||||
while (newHitIndex < aNewHits.Length() || tableRowIndex < rowCount) {
|
||||
mdbOid oid;
|
||||
nsMsgKey tableRowKey = nsMsgKey_None;
|
||||
|
|
Загрузка…
Ссылка в новой задаче