Make nsFind::Find actually use a string type as input.

This commit is contained in:
Fedor 2019-06-12 13:44:58 +03:00
parent f3e18922ba
commit 8cc6eb8551
5 changed files with 4 additions and 22 deletions

View File

@ -932,7 +932,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 char16_t* aPatText, nsIDOMRange* aSearchRange,
nsFind::Find(const nsAString& aPatText, nsIDOMRange* aSearchRange,
nsIDOMRange* aStartPoint, nsIDOMRange* aEndPoint,
nsIDOMRange** aRangeRet)
{
@ -949,10 +949,6 @@ nsFind::Find(const char16_t* aPatText, nsIDOMRange* aSearchRange,
NS_ENSURE_ARG_POINTER(aRangeRet);
*aRangeRet = 0;
if (!aPatText) {
return NS_ERROR_NULL_POINTER;
}
ResetAll();
nsAutoString patAutoStr(aPatText);

View File

@ -29,6 +29,6 @@ interface nsIFind : nsISupports
* end (forward) or start (backward).
* @retval A range spanning the match that was found (or null).
*/
nsIDOMRange Find(in wstring aPatText, in nsIDOMRange aSearchRange,
nsIDOMRange Find(in AString aPatText, in nsIDOMRange aSearchRange,
in nsIDOMRange aStartPoint, in nsIDOMRange aEndPoint);
};

View File

@ -751,7 +751,7 @@ nsWebBrowserFind::SearchInFrame(nsPIDOMWindowOuter* aWindow, bool aWrapping,
NS_ENSURE_SUCCESS(rv, rv);
rv = find->Find(mSearchString.get(), searchRange, startPt, endPt,
rv = find->Find(mSearchString, searchRange, startPt, endPt,
getter_AddRefs(foundRange));
if (NS_SUCCEEDED(rv) && foundRange) {

View File

@ -33,20 +33,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=450048
var startPt = searchRange;
var endPt = searchRange;
// Check |null| detection on |aPatText| parameter.
try {
rf.Find(null, searchRange, startPt, endPt);
ok(false, "Missing NS_ERROR_NULL_POINTER exception");
} catch (e) {
e = SpecialPowers.wrap(e);
if (e.result == SpecialPowers.Cr.NS_ERROR_NULL_POINTER) {
ok(true, null);
} else {
throw e;
}
}
// Check |null| detection on |aSearchRange| parameter.
try {
rf.Find("", null, startPt, endPt);

View File

@ -420,7 +420,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.get(), mSearchRange, mStartPointRange,
mFind->Find(mTypeAheadBuffer, mSearchRange, mStartPointRange,
mEndPointRange, getter_AddRefs(returnRange));
if (!returnRange)