Bug 1422545 - Do not close connection between a httpChannelChild and its httpChannelParent if we need to divert to parent.r=mayhemer

If UnknowDecoder is involved and the received content is short we will know whether we need to divert to parent only after OnStartRequest of the listener chain is called. Therefore do not do cleanup if we detect diversion.
This commit is contained in:
Dragana Damjanovic 2017-12-20 16:13:36 +01:00
Родитель 34afbed5d9
Коммит 00a47a6f30
1 изменённых файлов: 13 добавлений и 0 удалений

Просмотреть файл

@ -1100,6 +1100,19 @@ HttpChannelChild::OnStopRequest(const nsresult& channelStatus,
// DoOnStopRequest() calls ReleaseListeners()
}
// If unknownDecoder is involved and the received content is short we will
// know whether we need to divert to parent only after OnStopRequest of the
// listeners chain is called in DoOnStopRequest. At that moment
// unknownDecoder will call OnStartRequest of the real listeners of the
// channel including the OnStopRequest of UrlLoader which decides whether we
// need to divert to parent.
// If we are diverting to parent we should not do a cleanup.
if (mDivertingToParent) {
LOG(("HttpChannelChild::OnStopRequest - We are diverting to parent, "
"postpone cleaning up."));
return;
}
CleanupBackgroundChannel();
// If there is a possibility we might want to write alt data to the cache