Hello everyone.
I have an embedding app using nsIWebBrowser, et al. The problem is that
my alerts / confirms, etc. are coming up as non-modal (you can go back
to the main app while the dialog is up). My GetNewWindow fn is below. I
know that CreateTopLevelWindow without a parent gives you a non-modal
window. I guess my question boils down to... how do I get a valid
nsIXULWindow from WebBrowser to pass in as a parent?
Thanks!
NS_IMETHODIMP Foo::GetNewWindow(PRInt32 aChromeFlags,
nsIDocShellTreeItem **_retval)
{
*_retval = nsnull;
nsresult rv;
nsCOMPtr<nsIXULWindow> newWindow;
rv = mViewer->mAppShellService->CreateTopLevelWindow(nsnull, nsnull,
PR_FALSE, PR_FALSE,
aChromeFlags, NS_SIZETOCONTENT, NS_SIZETOCONTENT,
getter_AddRefs(newWindow));
NS_ENSURE_TRUE(newWindow, rv);
if (NS_FAILED (rv))
return rv;
nsCOMPtr<nsIDocShell> docShell;
newWindow->GetDocShell(getter_AddRefs(docShell));
CallQueryInterface(docShell, _retval);
return NS_OK;
}