} else { doStopURLLoad(aRequest, aStatus); }  return NS_OK;
NS_METHOD nsDocumentBindInfo::OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)#endif{    nsresult rv = NS_OK;#ifdef NECKO    nsCOMPtr<nsIURI> aURL;    rv = channel->GetURI(getter_AddRefs(aURL));    if (NS_FAILED(rv)) return rv;#endif#if defined(DEBUG)#ifdef NECKO    char* spec;#else    const char* spec;#endif    (void)aURL->GetSpec(&spec);    PR_LOG(gDocLoaderLog, PR_LOG_DEBUG,            ("DocumentBindInfo:%p: OnStopRequest(...) called for %s.  Status: %d.\n",             this, spec, aStatus));#ifdef NECKO    nsCRT::free(spec);#endif#endif // DEBUG#ifdef DEBUG    if (NS_FAILED(aStatus)) {#ifdef NECKO        char *url;        if (NS_SUCCEEDED(rv))             aURL->GetSpec(&url);        else            url = nsCRT::strdup("");#else        const char *url;        if (nsnull != aURL)             aURL->GetSpec(&url);        else            url = "";      #endif // NECKO#ifdef DEBUG_pnunn        cerr << "nsDocumentBindInfo::OnStopRequest: Load of URL '" << url << "' failed.  Error code: "              << NS_ERROR_GET_CODE(aStatus) << "\n";#endif#ifdef NECKO        if (aStatus == NS_ERROR_UNKNOWN_HOST)            printf("Error: Unknown host: %s\n", url);        else if (aStatus == NS_ERROR_MALFORMED_URI)            printf("Error: Malformed URI: %s\n", url);        else if (NS_FAILED(rv))            printf("Error: Can't load: %s (%x)\n", url, aStatus);        nsCRT::free(url);#endif    }#endif /* DEBUG */    if (nsnull != m_NextStream) {#ifdef NECKO        rv = m_NextStream->OnStopRequest(channel, ctxt, aStatus, aMsg);#else        rv = m_NextStream->OnStopRequest(aURL, aStatus, aMsg);#endif    }    /* Pass the notification out to the Observer... */    if (nsnull != m_Observer) {        /* XXX: Should we ignore the return value? */#ifdef NECKO        (void) m_Observer->OnStopRequest(channel, ctxt, aStatus, aMsg);#else        (void) m_Observer->OnStopRequest(aURL, aStatus, aMsg);#endif    }    /*     * The stream is complete...  Tell the DocumentLoader to release us...     */#ifdef NECKO    rv = m_DocLoader->LoadURLComplete(channel, ctxt, (nsIStreamListener *)this,                                      aStatus, aMsg);#else    rv = m_DocLoader->LoadURLComplete(aURL, (nsIStreamListener *)this, aStatus);#endif    NS_IF_RELEASE(m_NextStream);#ifdef NECKO    if (aStatus == NS_ERROR_UNKNOWN_HOST) {        // We need to check for a dns failure in aStatus, but dns failure codes        // aren't proliferated yet. This checks for failure for a host lacking        // "www." and/or ".com" and munges the url acordingly, then fires off        // a new request.        //        // XXX This code may or may not have mem leaks depending on the version        // XXX stdurl that is in the tree at a given point in time. This needs to        // XXX be fixed once we have a solid version of std url in.        char *host = nsnull;        nsString2 hostStr;        rv = aURL->GetHost(&host);        if (NS_FAILED(rv)) return rv;        hostStr.SetString(host);        PRInt32 dotLoc = -1;        dotLoc = hostStr.Find('.');        PRBool retry = PR_FALSE;        if (-1 == dotLoc) {            hostStr.Insert("www.", 0, 4);            hostStr.Append(".com");            retry = PR_TRUE;        } else if ( (hostStr.Length() - dotLoc) == 3) {            hostStr.Insert("www.", 0, 4);            retry = PR_TRUE;        }        if (retry) {            char *modHost = hostStr.ToNewCString();            if (!modHost)                return NS_ERROR_OUT_OF_MEMORY;            rv = aURL->SetHost(modHost);            delete [] modHost;            modHost = nsnull;            if (NS_FAILED(rv)) return rv;            char *aSpec = nsnull;            rv = aURL->GetSpec(&aSpec);            if (NS_FAILED(rv)) return rv;            nsString2 newURL(aSpec);            return m_DocLoader->LoadDocument(newURL,                                              m_Command,                                             m_Container,                                             nsnull, // XXX need to pass post data along                                             m_ExtraInfo,                                             m_Observer,                                             nsIChannel::LOAD_NORMAL,                                             0);        }    }#endif // NECKO    return rv;}