rv = m_DocLoader->CreateContentViewer(m_Command, channel, aContentType, m_Container, m_ExtraInfo, getter_AddRefs(m_NextStream), &viewer); } else { rv = NS_ERROR_NULL_POINTER; }
if (!useURILoader) { PRBool conversionRequired = PR_FALSE; nsAutoString from, to;
nsDocumentBindInfo::OnStartRequest(nsIChannel* channel, nsISupports *ctxt){    nsresult rv = NS_OK;    nsIContentViewer* viewer = nsnull;    nsCOMPtr<nsIURI> aURL;    rv = channel->GetURI(getter_AddRefs(aURL));    if (NS_FAILED(rv)) return rv;    char* aContentType = nsnull;    rv = channel->GetContentType(&aContentType);    if (NS_FAILED(rv)) return rv;#if defined(DEBUG)    char* spec;    (void)aURL->GetSpec(&spec);    PR_LOG(gDocLoaderLog, PR_LOG_DEBUG,            ("DocumentBindInfo:%p OnStartRequest(...) called for %s.  Content-type is %s\n",            this, spec, aContentType));    nsCRT::free(spec);#endif /* DEBUG */    if (nsnull == m_NextStream) {        /*         * Now that the content type is available, create a document         * (and viewer) of the appropriate type...         */        if (m_DocLoader) {            rv = m_DocLoader->CreateContentViewer(m_Command,                                                   channel,                                                  aContentType,                                                   m_Container,                                                  m_ExtraInfo,                                                  getter_AddRefs(m_NextStream),                                                   &viewer);        } else {            rv = NS_ERROR_NULL_POINTER;        }        if (NS_FAILED(rv)) {            printf("DocLoaderFactory: Unable to create ContentViewer for command=%s, content-type=%s\n", m_Command ? m_Command : "(null)", aContentType);            nsCOMPtr<nsIContentViewerContainer>                cvContainer(do_QueryInterface(m_Container));            if ( cvContainer ) {                // Give content container a chance to do something with this URL.                rv = cvContainer->HandleUnknownContentType( (nsIDocumentLoader*) m_DocLoader, channel, aContentType, m_Command );            }            // Stop the binding.            // This crashes on Unix/Mac... Stop();            goto done;        }        /*         * Give the document container the new viewer...         */        nsCOMPtr<nsIContentViewerContainer>                                  cvContainer(do_QueryInterface(m_Container));        if (cvContainer) {            viewer->SetContainer(m_Container);            rv = cvContainer->Embed(viewer, m_Command, m_ExtraInfo);            if (NS_FAILED(rv)) {                goto done;            }        }    }    /*     * Pass the OnStartRequest(...) notification out to the document      * IStreamListener.     */    if (nsnull != m_NextStream) {        rv = m_NextStream->OnStartRequest(channel, ctxt);    }  done:    NS_IF_RELEASE(viewer);    nsCRT::free(aContentType);    return rv;}