Bug 195243. Potential hang in typeaheadfind. r=caillon, sr=sspitzer

This commit is contained in:
aaronl%netscape.com 2003-03-06 18:38:16 +00:00
Родитель 62af7c09a7
Коммит 70e6b0b21f
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -1330,6 +1330,7 @@ nsTypeAheadFind::FindItNow(nsIPresShell *aPresShell,
// ======= end-inner-while (go through a single document) ==========
// ---------- Nothing found yet, try next document -------------
PRBool hasTriedFirstDoc = PR_FALSE;
do {
// ==== Second inner loop - get another while ====
if (NS_SUCCEEDED(docShellEnumerator->HasMoreElements(&hasMoreDocShells))
@ -1342,11 +1343,15 @@ nsTypeAheadFind::FindItNow(nsIPresShell *aPresShell,
break;
}
}
else if (!hasTriedFirstDoc) { // Avoid potential infinite loop
return NS_ERROR_FAILURE; // No content doc shells
}
// Reached last doc shell, loop around back to first doc shell
rootContentDocShell->GetDocShellEnumerator(nsIDocShellTreeItem::typeContent,
nsIDocShell::ENUMERATE_FORWARDS,
getter_AddRefs(docShellEnumerator));
hasTriedFirstDoc = PR_TRUE;
} while (docShellEnumerator); // ==== end second inner while ===
PRBool continueLoop = PR_FALSE;