reverted nsFind changes as it caused crash.

This commit is contained in:
2019-05-20 21:13:15 +08:00
parent a7e84f4edf
commit 0092576ecf
4 changed files with 8 additions and 4 deletions
+5 -1
View File
@@ -853,7 +853,7 @@ nsFind::ResetAll()
// Take nodes out of the tree with NextNode, until null (NextNode will return 0
// at the end of our range).
NS_IMETHODIMP
nsFind::Find(const nsAString& aPatText, nsIDOMRange* aSearchRange,
nsFind::Find(const char16_t* aPatText, nsIDOMRange* aSearchRange,
nsIDOMRange* aStartPoint, nsIDOMRange* aEndPoint,
nsIDOMRange** aRangeRet)
{
@@ -870,6 +870,10 @@ nsFind::Find(const nsAString& aPatText, nsIDOMRange* aSearchRange,
NS_ENSURE_ARG_POINTER(aRangeRet);
*aRangeRet = 0;
if (!aPatText) {
return NS_ERROR_NULL_POINTER;
}
ResetAll();
nsAutoString patAutoStr(aPatText);
+1 -1
View File
@@ -34,6 +34,6 @@ interface nsIFind : nsISupports
* end (forward) or start (backward).
* @retval A range spanning the match that was found (or null).
*/
nsIDOMRange Find(in AString aPatText, in nsIDOMRange aSearchRange,
nsIDOMRange Find(in wstring aPatText, in nsIDOMRange aSearchRange,
in nsIDOMRange aStartPoint, in nsIDOMRange aEndPoint);
};
@@ -756,7 +756,7 @@ nsWebBrowserFind::SearchInFrame(nsIDOMWindow* aWindow, bool aWrapping,
NS_ENSURE_SUCCESS(rv, rv);
rv = find->Find(mSearchString, searchRange, startPt, endPt,
rv = find->Find(mSearchString.get(), searchRange, startPt, endPt,
getter_AddRefs(foundRange));
if (NS_SUCCEEDED(rv) && foundRange) {
@@ -396,7 +396,7 @@ nsTypeAheadFind::FindItNow(nsIPresShell *aPresShell, bool aIsLinksOnly,
while (true) { // ----- Outer while loop: go through all docs -----
while (true) { // === Inner while loop: go through a single doc ===
mFind->Find(mTypeAheadBuffer, mSearchRange, mStartPointRange,
mFind->Find(mTypeAheadBuffer.get(), mSearchRange, mStartPointRange,
mEndPointRange, getter_AddRefs(returnRange));
if (!returnRange)