tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 1d136aef4fb9e37f677d2cbfdb18b3f18a023e40
parent 58afdd9c2861da7e473997e06310620daa32de64
Author: Kershaw Chang <kershaw@mozilla.com>
Date:   Thu, 27 Nov 2025 13:32:40 +0000

Bug 2002687 - CancelAllTransactions: drain queues before closing transactions, r=necko-reviewers,valentin

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

Diffstat:
Mnetwerk/protocol/http/PendingTransactionQueue.cpp | 20+++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/netwerk/protocol/http/PendingTransactionQueue.cpp b/netwerk/protocol/http/PendingTransactionQueue.cpp @@ -267,23 +267,25 @@ void PendingTransactionQueue::Compact() { } void PendingTransactionQueue::CancelAllTransactions(nsresult reason) { - for (const auto& pendingTransInfo : mUrgentStartQ) { - LOG(("PendingTransactionQueue::CancelAllTransactions %p\n", - pendingTransInfo->Transaction())); - pendingTransInfo->Transaction()->Close(reason); + AutoTArray<nsHttpTransaction*, 64> toClose; + for (const auto& info : mUrgentStartQ) { + toClose.AppendElement(info->Transaction()); } mUrgentStartQ.Clear(); + // Drain all table entries into toClose, then clear them. for (const auto& data : mPendingTransactionTable.Values()) { - for (const auto& pendingTransInfo : *data) { - LOG(("PendingTransactionQueue::CancelAllTransactions %p\n", - pendingTransInfo->Transaction())); - pendingTransInfo->Transaction()->Close(reason); + for (const auto& info : *data) { + toClose.AppendElement(info->Transaction()); } data->Clear(); } - mPendingTransactionTable.Clear(); + + for (auto trans : toClose) { + LOG(("PendingTransactionQueue::CancelAllTransactions %p\n", trans)); + trans->Close(reason); + } } } // namespace net