зеркало из https://github.com/mozilla/pjs.git
Bug 195243. Potential hang in typeaheadfind. r=caillon, sr=sspitzer
This commit is contained in:
Родитель
62af7c09a7
Коммит
70e6b0b21f
|
@ -1330,6 +1330,7 @@ nsTypeAheadFind::FindItNow(nsIPresShell *aPresShell,
|
||||||
// ======= end-inner-while (go through a single document) ==========
|
// ======= end-inner-while (go through a single document) ==========
|
||||||
|
|
||||||
// ---------- Nothing found yet, try next document -------------
|
// ---------- Nothing found yet, try next document -------------
|
||||||
|
PRBool hasTriedFirstDoc = PR_FALSE;
|
||||||
do {
|
do {
|
||||||
// ==== Second inner loop - get another while ====
|
// ==== Second inner loop - get another while ====
|
||||||
if (NS_SUCCEEDED(docShellEnumerator->HasMoreElements(&hasMoreDocShells))
|
if (NS_SUCCEEDED(docShellEnumerator->HasMoreElements(&hasMoreDocShells))
|
||||||
|
@ -1342,11 +1343,15 @@ nsTypeAheadFind::FindItNow(nsIPresShell *aPresShell,
|
||||||
break;
|
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
|
// Reached last doc shell, loop around back to first doc shell
|
||||||
rootContentDocShell->GetDocShellEnumerator(nsIDocShellTreeItem::typeContent,
|
rootContentDocShell->GetDocShellEnumerator(nsIDocShellTreeItem::typeContent,
|
||||||
nsIDocShell::ENUMERATE_FORWARDS,
|
nsIDocShell::ENUMERATE_FORWARDS,
|
||||||
getter_AddRefs(docShellEnumerator));
|
getter_AddRefs(docShellEnumerator));
|
||||||
|
hasTriedFirstDoc = PR_TRUE;
|
||||||
} while (docShellEnumerator); // ==== end second inner while ===
|
} while (docShellEnumerator); // ==== end second inner while ===
|
||||||
|
|
||||||
PRBool continueLoop = PR_FALSE;
|
PRBool continueLoop = PR_FALSE;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче