Write the html, title, and body tags directly to the stream listener

without having them go through the txt->html conversion.  This makes it so
we don't accidentely try to form an HREF inside the title.  r=valeski.
This commit is contained in:
bryner%uiuc.edu 2000-04-17 04:40:44 +00:00
parent f347a29188
commit efb948c488

View File

@ -63,8 +63,25 @@ nsTXTToHTMLConv::OnStartRequest(nsIChannel *aChannel, nsISupports *aContext) {
mBuffer.AppendWithConversion("<pre>\n");
}
return mListener->OnStartRequest(aChannel, aContext);
// Push mBuffer to the listener now, so the initial HTML will not
// be parsed in OnDataAvailable().
nsresult rv = mListener->OnStartRequest(aChannel, aContext);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIInputStream> inputData;
nsCOMPtr<nsISupports> inputDataSup;
rv = NS_NewStringInputStream(getter_AddRefs(inputDataSup), mBuffer);
if (NS_FAILED(rv)) return rv;
inputData = do_QueryInterface(inputDataSup);
rv = mListener->OnDataAvailable(aChannel, aContext,
inputData, 0, mBuffer.Length());
if (NS_FAILED(rv)) return rv;
mBuffer.AssignWithConversion("");
return rv;
}
NS_IMETHODIMP
nsTXTToHTMLConv::OnStopRequest(nsIChannel *aChannel, nsISupports *aContext,
nsresult aStatus, const PRUnichar *aMsg) {