tor-browser

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

commit b1edef3cef159670bc464890d055078259bd07ea
parent d4c735d662766f99e8233d8978470b2c7f207bfc
Author: Randell Jesup <rjesup@mozilla.com>
Date:   Wed,  1 Oct 2025 18:45:55 +0000

Bug 1978496: Add logs for CompressionDictionaries r=necko-reviewers,sunil,kershaw

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

Diffstat:
Mnetwerk/protocol/http/HttpBaseChannel.cpp | 4+++-
Mnetwerk/protocol/http/HttpLog.h | 4++++
Mnetwerk/protocol/http/nsHttpChannel.cpp | 14++++++--------
3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/netwerk/protocol/http/HttpBaseChannel.cpp b/netwerk/protocol/http/HttpBaseChannel.cpp @@ -1548,7 +1548,7 @@ HttpBaseChannel::DoApplyContentConversions(nsIStreamListener* aNextListener, return rv; } - LOG(("converter removed '%s' content-encoding\n", val)); + LOG(("Adding converter for content-encoding '%s'", val)); if (Telemetry::CanRecordPrereleaseData()) { int mode = 0; if (from.EqualsLiteral("gzip") || from.EqualsLiteral("x-gzip")) { @@ -1573,6 +1573,8 @@ HttpBaseChannel::DoApplyContentConversions(nsIStreamListener* aNextListener, } } + LOG(("Changing Content-Encoding from %s to %s", contentEncoding.get(), + newEncoding.get())); rv = mResponseHead->SetHeader(nsHttp::Content_Encoding, newEncoding); *aNewNextListener = do_AddRef(nextListener).take(); diff --git a/netwerk/protocol/http/HttpLog.h b/netwerk/protocol/http/HttpLog.h @@ -41,6 +41,7 @@ void LogCallingScriptLocation(void* instance, const Maybe<nsCString>& aLogLocation); extern LazyLogModule gHttpLog; extern LazyLogModule gHttpIOLog; +extern LazyLogModule gDictionaryLog; } // namespace net } // namespace mozilla @@ -71,4 +72,7 @@ extern LazyLogModule gHttpIOLog; MOZ_LOG_TEST(mozilla::net::gHttpLog, mozilla::LogLevel::Verbose) #define LOG_ENABLED() LOG4_ENABLED() +#define LOG_DICTIONARIES(args) \ + MOZ_LOG(mozilla::net::gDictionaryLog, mozilla::LogLevel::Debug, args) + #endif // HttpLog_h__ diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp @@ -150,9 +150,6 @@ # include "mozilla/StaticPrefs_fuzzing.h" #endif -// TODO replace in later patch -#define LOG_DICTIONARIES(x) LOG(x) - namespace mozilla { using namespace dom; @@ -5968,7 +5965,7 @@ bool nsHttpChannel::ParseDictionary(nsICacheEntry* aEntry, nsCString hash; // Available now for use RefPtr<DictionaryCache> dicts(DictionaryCache::GetInstance()); - LOG( + LOG_DICTIONARIES( ("Adding DictionaryCache entry for %s: key %s, matchval %s, id=%s, " "type=%s", mURI->GetSpecOrDefault().get(), key.get(), matchVal.get(), @@ -6120,8 +6117,8 @@ nsresult nsHttpChannel::InstallCacheListener(int64_t offset) { // before the content process gets to see it nsAutoCString contentEncoding; Unused << mResponseHead->GetHeader(nsHttp::Content_Encoding, contentEncoding); - LOG(("Content-Encoding for %p: %s", this, - PromiseFlatCString(contentEncoding).get())); + LOG_DICTIONARIES( + ("Content-Encoding for %p: %s", this, contentEncoding.get())); if (!dictionary.IsEmpty() || contentEncoding.Equals("dcb") || contentEncoding.Equals("dcz")) { nsCOMPtr<nsIStreamListener> listener; @@ -6133,12 +6130,13 @@ nsresult nsHttpChannel::InstallCacheListener(int64_t offset) { return rv; } if (listener) { - LOG(("Installed nsHTTPCompressConv %p before tee", listener.get())); + LOG_DICTIONARIES( + ("Installed nsHTTPCompressConv %p before tee", listener.get())); mListener = listener; mCompressListener = listener; StoreHasAppliedConversion(true); } else - LOG(("Didn't install decompressor before tee")); + LOG_DICTIONARIES(("Didn't install decompressor before tee")); } // XXX telemetry as to how often we get dcb/dcz