commit 85e61925eafece482903b3463054ef75ab47150b
parent 8dcd83acc166daece69c1a64c1bd7bbb30b63e58
Author: Randell Jesup <rjesup@mozilla.com>
Date: Tue, 7 Oct 2025 17:55:54 +0000
Bug 1978496: Add logs for CompressionDictionaries r=necko-reviewers,sunil,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D258116
Diffstat:
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/netwerk/protocol/http/HttpBaseChannel.cpp b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -1549,7 +1549,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")) {
@@ -1574,6 +1574,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