Bug 1397880 - Cancel tailing timer during shutdown. r?nwgh
RequestContextService will cancel all the blocked tail requests during xpcom-shutdown.
However, the timer for unblocking tail request might be already running.
RequestContext need to cancel the timer when all blocked tail request is canceled for that context.
MozReview-Commit-ID: 1Nbzu2a788w
--- a/netwerk/base/RequestContextService.cpp
+++ b/netwerk/base/RequestContextService.cpp
@@ -375,16 +375,27 @@ RequestContext::CancelTailedRequest(nsIR
{
MOZ_ASSERT(NS_IsMainThread());
bool removed = mTailQueue.RemoveElement(aRequest);
LOG(("RequestContext::CancelTailedRequest %p req=%p removed=%d",
this, aRequest, removed));
+ // Stop untail timer if all tail requests are canceled.
+ if (removed && mTailQueue.IsEmpty()) {
+ if (mUntailTimer) {
+ mUntailTimer->Cancel();
+ mUntailTimer = nullptr;
+ }
+
+ // Must drop to stop tailing requests
+ mUntailAt = TimeStamp();
+ }
+
return NS_OK;
}
void
RequestContext::ProcessTailQueue(nsresult aResult)
{
LOG(("RequestContext::ProcessTailQueue this=%p, queued=%zu, rv=%" PRIx32,
this, mTailQueue.Length(), static_cast<uint32_t>(aResult)));