зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
f4890f97e2
Коммит
a3a0264f41
|
@ -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) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче