mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 669845: Make nsTypeFindAhead clear out all of its references to content nodes when reset. r=gavin
This commit is contained in:
parent
b4c45712be
commit
19137795c6
@ -109,7 +109,8 @@ nsTypeAheadFind::nsTypeAheadFind():
|
||||
mStartLinksOnlyPref(false),
|
||||
mCaretBrowsingOn(false),
|
||||
mLastFindLength(0),
|
||||
mIsSoundInitialized(false)
|
||||
mIsSoundInitialized(false),
|
||||
mCaseSensitive(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -129,8 +130,7 @@ nsTypeAheadFind::Init(nsIDocShell* aDocShell)
|
||||
mSearchRange = new nsRange();
|
||||
mStartPointRange = new nsRange();
|
||||
mEndPointRange = new nsRange();
|
||||
mFind = do_CreateInstance(NS_FIND_CONTRACTID);
|
||||
if (!prefInternal || !mFind)
|
||||
if (!prefInternal || !EnsureFind())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
SetDocShell(aDocShell);
|
||||
@ -142,10 +142,6 @@ nsTypeAheadFind::Init(nsIDocShell* aDocShell)
|
||||
// ----------- Get initial preferences ----------
|
||||
PrefsReset();
|
||||
|
||||
// ----------- Set search options ---------------
|
||||
mFind->SetCaseSensitive(false);
|
||||
mFind->SetWordBreaker(nsnull);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -176,14 +172,20 @@ nsTypeAheadFind::PrefsReset()
|
||||
NS_IMETHODIMP
|
||||
nsTypeAheadFind::SetCaseSensitive(bool isCaseSensitive)
|
||||
{
|
||||
mFind->SetCaseSensitive(isCaseSensitive);
|
||||
mCaseSensitive = isCaseSensitive;
|
||||
|
||||
if (mFind) {
|
||||
mFind->SetCaseSensitive(mCaseSensitive);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTypeAheadFind::GetCaseSensitive(bool* isCaseSensitive)
|
||||
{
|
||||
mFind->GetCaseSensitive(isCaseSensitive);
|
||||
*isCaseSensitive = mCaseSensitive;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -202,6 +204,7 @@ nsTypeAheadFind::SetDocShell(nsIDocShell* aDocShell)
|
||||
mStartFindRange = nsnull;
|
||||
mStartPointRange = new nsRange();
|
||||
mSearchRange = new nsRange();
|
||||
mEndPointRange = new nsRange();
|
||||
|
||||
mFoundLink = nsnull;
|
||||
mFoundEditable = nsnull;
|
||||
@ -209,6 +212,8 @@ nsTypeAheadFind::SetDocShell(nsIDocShell* aDocShell)
|
||||
|
||||
mSelectionController = nsnull;
|
||||
|
||||
mFind = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -393,7 +398,7 @@ nsTypeAheadFind::FindItNow(nsIPresShell *aPresShell, bool aIsLinksOnly,
|
||||
// No need to wrap find in doc if starting at beginning
|
||||
bool hasWrapped = (rangeCompareResult < 0);
|
||||
|
||||
if (mTypeAheadBuffer.IsEmpty())
|
||||
if (mTypeAheadBuffer.IsEmpty() || !EnsureFind())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mFind->SetFindBackwards(aFindPrev);
|
||||
|
@ -128,6 +128,25 @@ protected:
|
||||
|
||||
// Cached useful interfaces
|
||||
nsCOMPtr<nsIFind> mFind;
|
||||
|
||||
bool mCaseSensitive;
|
||||
|
||||
bool EnsureFind() {
|
||||
if (mFind) {
|
||||
return true;
|
||||
}
|
||||
|
||||
mFind = do_CreateInstance("@mozilla.org/embedcomp/rangefind;1");
|
||||
if (!mFind) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mFind->SetCaseSensitive(mCaseSensitive);
|
||||
mFind->SetWordBreaker(nsnull);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWebBrowserFind> mWebBrowserFind;
|
||||
|
||||
// The focused content window that we're listening to and its cached objects
|
||||
|
Loading…
Reference in New Issue
Block a user