Bug 1220681 P5 Don't double suspend parent channel during synthesized divert to parent. r=jdm

This commit is contained in:
Ben Kelly 2015-12-23 12:20:53 -08:00
parent d6efdcc1b2
commit bbbb4dd4fa

View File

@ -1438,11 +1438,21 @@ HttpChannelParent::SuspendForDiversion()
return NS_ERROR_UNEXPECTED;
}
nsresult rv = NS_OK;
// Try suspending the channel. Allow it to fail, since OnStopRequest may have
// been called and thus the channel may not be pending.
nsresult rv = mChannel->Suspend();
MOZ_ASSERT(NS_SUCCEEDED(rv) || rv == NS_ERROR_NOT_AVAILABLE);
mSuspendedForDiversion = NS_SUCCEEDED(rv);
// been called and thus the channel may not be pending. If we've already
// automatically suspended after synthesizing the response, then we don't
// need to suspend again here.
if (!mSuspendAfterSynthesizeResponse) {
rv = mChannel->Suspend();
MOZ_ASSERT(NS_SUCCEEDED(rv) || rv == NS_ERROR_NOT_AVAILABLE);
mSuspendedForDiversion = NS_SUCCEEDED(rv);
} else {
// Take ownership of the automatic suspend that occurred after synthesizing
// the response.
mSuspendedForDiversion = true;
}
rv = mParentListener->SuspendForDiversion();
MOZ_ASSERT(NS_SUCCEEDED(rv));