Fix bug 302962. When someone calls Activate() or Deactivate() on an nsWebBrowser which doesn't have a content viewer yet (and hence no pres shell), don't just bail because nsGlobalWindow will complain. Instead, change nsDocShell to make the content viewer on demand, and go ahead and pass the activate/deactivate onto the dom window. This fixes a serious focus bug in Camino.

r/sr=bryner, a=bsmdedberg.


git-svn-id: svn://10.0.0.236/trunk@177273 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
smfr%smfr.org
2005-08-06 20:28:42 +00:00
parent 7e68744ffd
commit 3638d5ef12
3 changed files with 17 additions and 35 deletions

View File

@@ -1248,21 +1248,17 @@ nsDocShell::GetEldestPresContext(nsPresContext** aPresContext)
NS_IMETHODIMP
nsDocShell::GetPresContext(nsPresContext ** aPresContext)
{
nsresult rv = NS_OK;
NS_ENSURE_ARG_POINTER(aPresContext);
*aPresContext = nsnull;
if (mContentViewer) {
nsCOMPtr<nsIDocumentViewer> docv(do_QueryInterface(mContentViewer));
nsresult rv = EnsureContentViewer();
if (NS_FAILED(rv))
return rv; // we're probably being destroyed
nsCOMPtr<nsIDocumentViewer> docv(do_QueryInterface(mContentViewer));
NS_ENSURE_TRUE(docv, NS_ERROR_NO_INTERFACE);
if (docv) {
rv = docv->GetPresContext(aPresContext);
}
}
// Fail silently, if no PresContext is available...
return rv;
return docv->GetPresContext(aPresContext);
}
NS_IMETHODIMP