FireOnStartDocumentLoad(this, uri); } else { nsCOMPtr<nsIContentViewer> viewer; nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(mContainer)); NS_ENSURE_TRUE(webShell, NS_ERROR_FAILURE);  webShell->GetContentViewer(getter_AddRefs(viewer));
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 ) {  rv = cvContainer->HandleUnknownContentType( (nsIDocumentLoader*) m_DocLoader, channel, aContentType, m_Command ); }   goto done; }
nsDocLoaderImpl::OnStartRequest(nsIChannel *aChannel, nsISupports *aCtxt){    // called each time a channel is added to the group.    nsresult rv;    //    // Only fire an OnStartDocumentLoad(...) if the document loader    // has initiated a load...  Otherwise, this notification has    // resulted from a channel being added to the load group.    //    if (mIsLoadingDocument) {        PRUint32 count;        rv = mLoadGroup->GetActiveCount(&count);        if (NS_FAILED(rv)) return rv;        if (1 == count) {            nsCOMPtr<nsIURI> uri;            rv = aChannel->GetURI(getter_AddRefs(uri));            if (NS_FAILED(rv)) return rv;            // This channel is associated with the entire document...            mDocumentChannel = aChannel;            FireOnStartDocumentLoad(this, uri);        }         else {          nsCOMPtr<nsIContentViewer> viewer;          nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(mContainer));          NS_ENSURE_TRUE(webShell, NS_ERROR_FAILURE);            webShell->GetContentViewer(getter_AddRefs(viewer));          FireOnStartURLLoad(this, aChannel, viewer);        }    }    return NS_OK;}