mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
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:
parent
f347a29188
commit
efb948c488
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user