зеркало из https://github.com/mozilla/pjs.git
fix for bug #397527: append folder and all ancestors to the include / exclude folder array in nsNavHistory::FilterResultSet(), to save repeated queries
r=dietrich, a=mconnor
This commit is contained in:
Родитель
b0ff1c9bc0
Коммит
44a135fe70
|
@ -4199,22 +4199,28 @@ nsNavHistory::FilterResultSet(nsNavHistoryQueryResultNode* aQueryNode,
|
|||
// check ancestors
|
||||
PRInt64 ancestor = parentId, lastAncestor;
|
||||
PRBool belongs = PR_FALSE;
|
||||
nsTArray<PRInt64> ancestorFolders;
|
||||
|
||||
while (!belongs) {
|
||||
// Avoid using |ancestor| itself if GetFolderIdForItem failed.
|
||||
lastAncestor = ancestor;
|
||||
ancestorFolders.AppendElement(ancestor);
|
||||
|
||||
// GetFolderIdForItems throws when called for the places-root
|
||||
if (NS_FAILED(bookmarks->GetFolderIdForItem(ancestor,&ancestor))) {
|
||||
break;
|
||||
} else if (excludeFolders[queryIndex]->IndexOf(ancestor) != -1) {
|
||||
break;
|
||||
} else if (includeFolders[queryIndex]->IndexOf(ancestor) != -1) {
|
||||
belongs = PR_TRUE;
|
||||
}
|
||||
}
|
||||
// if the parentId or any of its ancestors "belong",
|
||||
// include all of them. otherwise, exclude all of them.
|
||||
if (belongs) {
|
||||
includeFolders[queryIndex]->AppendElement(lastAncestor);
|
||||
includeFolders[queryIndex]->AppendElements(ancestorFolders);
|
||||
} else {
|
||||
excludeFolders[queryIndex]->AppendElement(lastAncestor);
|
||||
excludeFolders[queryIndex]->AppendElements(ancestorFolders);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче