Bug 1470861: Make nsFind::ResetAll reset mIterNode / mIterOffset too. r?mats draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 25 Jun 2018 12:49:14 +0200
changeset 810139 ca39a78c24ba527236c22a175544a4f245314b24
parent 810138 050eeb60b4abd1128825a8ae8838cd82af748186
child 810140 302ab388085afe8f56413eecefd7514bc44536f3
push id113905
push userbmo:emilio@crisal.io
push dateMon, 25 Jun 2018 12:31:46 +0000
reviewersmats
bugs1470861
milestone62.0a1
Bug 1470861: Make nsFind::ResetAll reset mIterNode / mIterOffset too. r?mats We do reset them implicitly next time we call Find(..), since we call ResetAll() at the beginning of it, then NextNode(..), which unconditionally overrides them, but this is clearer for the next thing I want to do. MozReview-Commit-ID: 6OW8MfkftTM
toolkit/components/find/nsFind.cpp
--- a/toolkit/components/find/nsFind.cpp
+++ b/toolkit/components/find/nsFind.cpp
@@ -901,16 +901,18 @@ nsFind::GetBlockParent(nsINode* aNode)
 }
 
 // Call ResetAll before returning, to remove all references to external objects.
 void
 nsFind::ResetAll()
 {
   mIterator = nullptr;
   mLastBlockParent = nullptr;
+  mIterNode = nullptr;
+  mIterOffset = -1;
 }
 
 #define NBSP_CHARCODE (CHAR_TO_UNICHAR(160))
 #define IsSpace(c) (nsCRT::IsAsciiSpace(c) || (c) == NBSP_CHARCODE)
 #define OVERFLOW_PINDEX (mFindBackward ? pindex < 0 : pindex > patLen)
 #define DONE_WITH_PINDEX (mFindBackward ? pindex <= 0 : pindex >= patLen)
 #define ALMOST_DONE_WITH_PINDEX (mFindBackward ? pindex <= 0 : pindex >= patLen - 1)