tor-browser

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

commit d5cf72906da0939539f3d8ff652a3876e132820e
parent 85e61925eafece482903b3463054ef75ab47150b
Author: Randell Jesup <rjesup@mozilla.com>
Date:   Tue,  7 Oct 2025 17:55:55 +0000

Bug 1975014: Add a pref for Compression Dictionaries r=necko-reviewers,kershaw

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

Diffstat:
Mmodules/libpref/init/StaticPrefList.yaml | 6++++++
Mnetwerk/protocol/http/nsHttpChannel.cpp | 4+++-
Mnetwerk/protocol/http/nsHttpHandler.cpp | 5++---
3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml @@ -15751,6 +15751,12 @@ value: false mirror: always +# Enable HTTP Compression Dictionary support +- name: network.http.dictionaries.enable + type: RelaxedAtomicBool + value: true + mirror: always + #--------------------------------------------------------------------------- # Prefs starting with "nglayout." #--------------------------------------------------------------------------- diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp @@ -5935,7 +5935,9 @@ nsresult DoAddCacheEntryHeaders(nsHttpChannel* self, nsICacheEntry* entry, if (NS_FAILED(rv)) return rv; // If this is being marked as a dictionary, add it to the list - self->ParseDictionary(entry, responseHead); + if (StaticPrefs::network_http_dictionaries_enable() && self->IsHTTPS()) { + self->ParseDictionary(entry, responseHead); + } // Indicate we have successfully finished setting metadata on the cache entry. rv = entry->MetaDataReady(); diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp @@ -665,9 +665,8 @@ nsresult nsHttpHandler::AddAcceptAndDictionaryHeaders( // XXX This would require that AddAcceptAndDictionaryHeaders be effectively // async, perhaps by passing a lambda to call AddAcceptAndDictionaryHeaders // and then unblock the request - aDict = - mDictionaryCache ? mDictionaryCache->GetDictionaryFor(aURI) : nullptr; - if (aDict) { + if (StaticPrefs::network_http_dictionaries_enable() && + (aDict = mDictionaryCache->GetDictionaryFor(aURI))) { rv = aRequest->SetHeader(nsHttp::Accept_Encoding, mDictionaryAcceptEncodings, false, nsHttpHeaderArray::eVarietyRequestOverride);