Bug 1576171 - Send ftp channel status via OnStartRequest r=valentin

In FtpChannelParent, we didn't propagate the channel status to FtpChannelChild. This could make child start to do diversion on a failed channel.
Like what we did in http channel, we should send the channel status to child via OnStartRequest message.

Differential Revision: https://phabricator.services.mozilla.com/D45648

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kershaw Chang 2019-09-12 16:24:43 +00:00
parent 4fad3bb9aa
commit bfea62cf48

View File

@ -408,6 +408,8 @@ FTPChannelParent::OnStartRequest(nsIRequest* aRequest) {
chan->GetContentLength(&contentLength);
nsCString contentType;
chan->GetContentType(contentType);
nsresult channelStatus = NS_OK;
chan->GetStatus(&channelStatus);
nsCString entityID;
nsCOMPtr<nsIResumableChannel> resChan = do_QueryInterface(aRequest);
@ -432,8 +434,9 @@ FTPChannelParent::OnStartRequest(nsIRequest* aRequest) {
chan->GetURI(getter_AddRefs(uri));
SerializeURI(uri, uriparam);
if (mIPCClosed || !SendOnStartRequest(mStatus, contentLength, contentType,
lastModified, entityID, uriparam)) {
if (mIPCClosed ||
!SendOnStartRequest(channelStatus, contentLength, contentType,
lastModified, entityID, uriparam)) {
return NS_ERROR_UNEXPECTED;
}
@ -479,7 +482,10 @@ FTPChannelParent::OnDataAvailable(nsIRequest* aRequest,
nsresult rv = NS_ReadInputStreamToString(aInputStream, data, aCount);
if (NS_FAILED(rv)) return rv;
if (mIPCClosed || !SendOnDataAvailable(mStatus, data, aOffset, aCount))
nsresult channelStatus = NS_OK;
mChannel->GetStatus(&channelStatus);
if (mIPCClosed || !SendOnDataAvailable(channelStatus, data, aOffset, aCount))
return NS_ERROR_UNEXPECTED;
return NS_OK;