if (httpChannel && mContentType.IsEmpty()) {   nsCAutoString contentType; httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Content-Type"), contentType);       if (contentType.Equals(NS_LITERAL_CSTRING("text/plain")) || contentType.Equals( NS_LITERAL_CSTRING("text/plain; charset=ISO-8859-1")) || contentType.Equals( NS_LITERAL_CSTRING("text/plain; charset=iso-8859-1"))) {    LOG(("  Possibly bogus text/plain; resetting type to " APPLICATION_MAYBE_TEXT)); httpChannel->SetContentType(NS_LITERAL_CSTRING(APPLICATION_MAYBE_TEXT)); } }
NS_IMETHODIMP nsDocumentOpenInfo::OnStartRequest(nsIRequest *request, nsISupports * aCtxt){  LOG(("[0x%p] nsDocumentOpenInfo::OnStartRequest", this));    nsresult rv = NS_OK;  //  // Deal with "special" HTTP responses:  //  // - In the case of a 204 (No Content)  or 205 (Reset Content) response, do not try to find a  //   content handler.  Just return.  This causes the request to be  //   ignored.  //  nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(request, &rv));  if (NS_SUCCEEDED(rv)) {    PRUint32 responseCode = 0;    rv = httpChannel->GetResponseStatus(&responseCode);    if (NS_FAILED(rv)) {      LOG_ERROR(("  Failed to get HTTP response status"));            // behave as in the canceled case      return NS_OK;    }    LOG(("  HTTP response status: %d", responseCode));    if (204 == responseCode || 205 == responseCode) {      return NS_OK;    }  }  //  // Make sure that the transaction has succeeded, so far...  //  nsresult status;  rv = request->GetStatus(&status);    NS_ASSERTION(NS_SUCCEEDED(rv), "Unable to get request status!");  if (NS_FAILED(rv)) return rv;  if (NS_FAILED(status)) {    LOG_ERROR(("  Request failed, status: 0x%08X", rv));      //    // The transaction has already reported an error - so it will be torn    // down. Therefore, it is not necessary to return an error code...    //    return NS_OK;  }  rv = DispatchContent(request, aCtxt);  LOG(("  After dispatch, m_targetStreamListener: 0x%p", m_targetStreamListener.get()));    if (m_targetStreamListener)    rv = m_targetStreamListener->OnStartRequest(request, aCtxt);  LOG(("  OnStartRequest returning: 0x%08X", rv));    return rv;}