mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-18 14:56:07 +00:00
Bug 195243. Potential hang in typeaheadfind. r=caillon, sr=sspitzer
This commit is contained in:
parent
bc707bca94
commit
06894f9174
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user