mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-24 02:35:41 +00:00
Fix Firefox typeahead find crashes. do_QueryReferent on an nsWeakPtr can
return a null after all! Bug 274625, patch by Michael Clackler <mikeclackler@hotmail.com>, r=bsmedberg, sr=bzbarsky
This commit is contained in:
parent
1951e8e908
commit
e904e4ef65
@ -282,6 +282,8 @@ nsTypeAheadFind::FindItNow(nsIPresShell *aPresShell,
|
||||
nsCOMPtr<nsIPresShell> startingPresShell (do_QueryReferent(mPresShell));
|
||||
if (!startingPresShell) {
|
||||
nsCOMPtr<nsIDocShell> ds = do_QueryReferent(mDocShell);
|
||||
NS_ENSURE_TRUE(ds, NS_ERROR_FAILURE);
|
||||
|
||||
ds->GetPresShell(getter_AddRefs(startingPresShell));
|
||||
mPresShell = do_GetWeakReference(startingPresShell);
|
||||
}
|
||||
@ -802,6 +804,8 @@ nsTypeAheadFind::Find(const nsAString& aSearchString, PRBool aLinksOnly, PRUint1
|
||||
nsCOMPtr<nsIPresShell> presShell (do_QueryReferent(mPresShell));
|
||||
if (!presShell) {
|
||||
nsCOMPtr<nsIDocShell> ds (do_QueryReferent(mDocShell));
|
||||
NS_ENSURE_TRUE(ds, NS_ERROR_FAILURE);
|
||||
|
||||
ds->GetPresShell(getter_AddRefs(presShell));
|
||||
mPresShell = do_GetWeakReference(presShell);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user