lazily instantiate mDocument. bug 88229 r=jst,rpotts

git-svn-id: svn://10.0.0.236/trunk@108236 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
danm%netscape.com 2001-11-16 02:14:53 +00:00
parent 569f8e6897
commit e3ad075016

View File

@ -748,6 +748,13 @@ NS_IMETHODIMP GlobalWindowImpl::GetPrincipal(nsIPrincipal** result)
NS_IMETHODIMP GlobalWindowImpl::GetDocument(nsIDOMDocument** aDocument)
{
/* lazily instantiate an about:blank document if necessary, and if we have
what it takes to do so. Note that domdoc here is the same thing as
our mDocument, but we don't have to explicitly set the member variable
because the docshell has already called SetNewDocument(). */
if (!mDocument && mDocShell)
nsCOMPtr<nsIDOMDocument> domdoc(do_GetInterface(mDocShell));
*aDocument = mDocument;
NS_IF_ADDREF(*aDocument);
return NS_OK;