mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
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:
parent
b3112de226
commit
9c0f9c251e
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user