rv = newLoader->Init();
NS_NEWXPCOM(newLoader, nsDocLoaderImpl); if (nsnull == newLoader) { *anInstance = nsnull; rv = NS_ERROR_OUT_OF_MEMORY; goto done; } rv = newLoader->QueryInterface(kIDocumentLoaderIID, (void**)anInstance); if (NS_SUCCEEDED(rv)) { AddChildGroup(newLoader); newLoader->SetParent(this); }
nsDocLoaderImpl::CreateDocumentLoader(nsIDocumentLoader** anInstance){  nsresult rv = NS_OK;  *anInstance = nsnull;    nsDocLoaderImpl * newLoader = new nsDocLoaderImpl();  NS_ENSURE_TRUE(newLoader, NS_ERROR_OUT_OF_MEMORY);    NS_ADDREF(newLoader);  // Initialize now that we have a reference  rv = newLoader->Init();  if (NS_SUCCEEDED(rv)) {    rv = newLoader->SetDocLoaderParent(this);  }    if (NS_SUCCEEDED(rv)) {    rv = mChildList.AppendObject((nsIDocumentLoader*)newLoader)        ? NS_OK : NS_ERROR_FAILURE;  }    if (NS_SUCCEEDED(rv)) {    rv = CallQueryInterface(newLoader, anInstance);  }    NS_RELEASE(newLoader);  return rv;}