mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
fixes bug 342581 "Crash on installing extension [@nsXPInstallManager::OnDataAvailable]" r=biesi sr=bzbarsky
This commit is contained in:
parent
969f609810
commit
08b95ea6ad
@ -382,24 +382,26 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) {
|
||||
rv = mListener->OnStartRequest(request, aContext);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = FormatInputStream(request, aContext, buffer);
|
||||
// The request may have been canceled, and if that happens, we want to
|
||||
// suppress calls to OnDataAvailable.
|
||||
request->GetStatus(&rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = FormatInputStream(request, aContext, buffer);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIndexedToHTML::OnStopRequest(nsIRequest* request, nsISupports *aContext,
|
||||
nsresult aStatus) {
|
||||
nsresult rv = NS_OK;
|
||||
nsString buffer;
|
||||
buffer.AssignLiteral("</table><hr/></body></html>\n");
|
||||
if (NS_SUCCEEDED(aStatus)) {
|
||||
nsString buffer;
|
||||
buffer.AssignLiteral("</table><hr/></body></html>\n");
|
||||
|
||||
rv = FormatInputStream(request, aContext, buffer);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mParser->OnStopRequest(request, aContext, aStatus);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
aStatus = FormatInputStream(request, aContext, buffer);
|
||||
}
|
||||
|
||||
mParser->OnStopRequest(request, aContext, aStatus);
|
||||
mParser = 0;
|
||||
|
||||
return mListener->OnStopRequest(request, aContext, aStatus);
|
||||
|
@ -93,6 +93,11 @@ nsTXTToHTMLConv::OnStartRequest(nsIRequest* request, nsISupports *aContext)
|
||||
nsresult rv = mListener->OnStartRequest(request, aContext);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// The request may have been canceled, and if that happens, we want to
|
||||
// suppress calls to OnDataAvailable.
|
||||
request->GetStatus(&rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIInputStream> inputData;
|
||||
rv = NS_NewStringInputStream(getter_AddRefs(inputData), mBuffer);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -625,6 +625,11 @@ nsresult nsUnknownDecoder::FireListenerNotifications(nsIRequest* request,
|
||||
|
||||
if (!mBuffer) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
// If the request was canceled, then we need to treat that equivalently
|
||||
// to an error returned by OnStartRequest.
|
||||
if (NS_SUCCEEDED(rv))
|
||||
request->GetStatus(&rv);
|
||||
|
||||
// Fire the first OnDataAvailable for the data that was read from the
|
||||
// stream into the sniffer buffer...
|
||||
if (NS_SUCCEEDED(rv) && (mBufferLen > 0)) {
|
||||
|
Loading…
Reference in New Issue
Block a user