Issue #1721 - Implement GlobalPrivacyControl

(and get rid of failed DoNotTrack)
This commit is contained in:
Moonchild 2021-10-07 21:38:26 +00:00 committed by roytam1
commit 50ad087351
14 changed files with 41 additions and 50 deletions

View file

@ -87,7 +87,7 @@
#define HTTP_PREF_PREFIX "network.http."
#define INTL_ACCEPT_LANGUAGES "intl.accept_languages"
#define BROWSER_PREF_PREFIX "browser.cache."
#define DONOTTRACK_HEADER_ENABLED "privacy.donottrackheader.enabled"
#define GPC_HEADER_ENABLED "privacy.GPCheader.enabled"
#define H2MANDATORY_SUITE "security.ssl3.ecdhe_rsa_aes_128_gcm_sha256"
#define ALLOW_EXPERIMENTS "network.allow-experiments"
#define SAFE_HINT_HEADER_VALUE "safeHint.enabled"
@ -181,7 +181,7 @@ nsHttpHandler::nsHttpHandler()
, mAcceptLanguagesIsDirty(true)
, mPromptTempRedirect(true)
, mEnablePersistentHttpsCaching(false)
, mDoNotTrackEnabled(false)
, mGPCEnabled(false)
, mSafeHintEnabled(false)
, mParentalControlEnabled(false)
, mHandlerActive(false)
@ -279,7 +279,7 @@ nsHttpHandler::Init()
prefBranch->AddObserver(UA_PREF_PREFIX, this, true);
prefBranch->AddObserver(INTL_ACCEPT_LANGUAGES, this, true);
prefBranch->AddObserver(BROWSER_PREF("disk_cache_ssl"), this, true);
prefBranch->AddObserver(DONOTTRACK_HEADER_ENABLED, this, true);
prefBranch->AddObserver(GPC_HEADER_ENABLED, this, true);
prefBranch->AddObserver(H2MANDATORY_SUITE, this, true);
prefBranch->AddObserver(HTTP_PREF("tcp_keepalive.short_lived_connections"), this, true);
prefBranch->AddObserver(HTTP_PREF("tcp_keepalive.long_lived_connections"), this, true);
@ -1497,11 +1497,11 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
// Tracking options
//
if (PREF_CHANGED(DONOTTRACK_HEADER_ENABLED)) {
if (PREF_CHANGED(GPC_HEADER_ENABLED)) {
cVar = false;
rv = prefs->GetBoolPref(DONOTTRACK_HEADER_ENABLED, &cVar);
rv = prefs->GetBoolPref(GPC_HEADER_ENABLED, &cVar);
if (NS_SUCCEEDED(rv)) {
mDoNotTrackEnabled = cVar;
mGPCEnabled = cVar;
}
}
// Hint option