Bug 1478428 - Move the network.cookie.cookieBehavior pref to StaticPrefList.h; r=baku

This commit is contained in:
Ehsan Akhgari 2018-07-25 13:04:30 -04:00
parent abc7c1f693
commit 56cf43358e
5 changed files with 12 additions and 14 deletions

View File

@ -30,6 +30,7 @@
#include "nsContentUtils.h"
#include "nsUnicharUtils.h"
#include "mozilla/Preferences.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/Telemetry.h"
#include "BatteryManager.h"
#include "mozilla/dom/CredentialsContainer.h"
@ -519,9 +520,8 @@ Navigator::Storage()
bool
Navigator::CookieEnabled()
{
bool cookieEnabled =
(Preferences::GetInt("network.cookie.cookieBehavior",
COOKIE_BEHAVIOR_REJECT) != COOKIE_BEHAVIOR_REJECT);
bool cookieEnabled = (StaticPrefs::network_cookie_cookieBehavior() !=
COOKIE_BEHAVIOR_REJECT);
// Check whether an exception overrides the global cookie behavior
// Note that the code for getting the URI here matches that in

View File

@ -326,7 +326,6 @@ nsContentUtils::sUserInteractionObserver = nullptr;
uint32_t nsContentUtils::sHandlingInputTimeout = 1000;
uint32_t nsContentUtils::sCookiesLifetimePolicy = nsICookieService::ACCEPT_NORMALLY;
uint32_t nsContentUtils::sCookiesBehavior = nsICookieService::BEHAVIOR_ACCEPT;
nsHtml5StringParser* nsContentUtils::sHTMLFragmentParser = nullptr;
nsIParser* nsContentUtils::sXMLFragmentParser = nullptr;
@ -689,10 +688,6 @@ nsContentUtils::Init()
"network.cookie.lifetimePolicy",
nsICookieService::ACCEPT_NORMALLY);
Preferences::AddUintVarCache(&sCookiesBehavior,
"network.cookie.cookieBehavior",
nsICookieService::BEHAVIOR_ACCEPT);
Preferences::AddBoolVarCache(&sDoNotTrackEnabled,
"privacy.donottrackheader.enabled", false);
@ -8783,7 +8778,7 @@ nsContentUtils::GetCookieBehaviorForPrincipal(nsIPrincipal* aPrincipal,
uint32_t* aBehavior)
{
*aLifetimePolicy = sCookiesLifetimePolicy;
*aBehavior = sCookiesBehavior;
*aBehavior = StaticPrefs::network_cookie_cookieBehavior();
// Any permissions set for the given principal will override our default
// settings from preferences.

View File

@ -3426,7 +3426,6 @@ private:
static bool sIsBytecodeCacheEnabled;
static int32_t sBytecodeCacheStrategy;
static uint32_t sCookiesLifetimePolicy;
static uint32_t sCookiesBehavior;
static bool sShortcutsCustomized;
static int32_t sPrivacyMaxInnerWidth;

View File

@ -1024,6 +1024,14 @@ VARCACHE_PREF(
bool, false
)
// 0-Accept, 1-dontAcceptForeign, 2-dontAcceptAny, 3-limitForeign
// Keep the old default of accepting all cookies
VARCACHE_PREF(
"network.cookie.cookieBehavior",
network_cookie_cookieBehavior,
int32_t, 0
)
// Enables the predictive service.
VARCACHE_PREF(
"network.predictor.enabled",

View File

@ -2230,10 +2230,6 @@ pref("network.proxy.proxy_over_tls", true);
pref("network.proxy.no_proxies_on", "localhost, 127.0.0.1");
pref("network.proxy.failover_timeout", 1800); // 30 minutes
pref("network.online", true); //online/offline
pref("network.cookie.cookieBehavior", 0); // 0-Accept, 1-dontAcceptForeign, 2-dontAcceptAny, 3-limitForeign
#ifdef ANDROID
pref("network.cookie.cookieBehavior", 0); // Keep the old default of accepting all cookies
#endif
pref("network.cookie.thirdparty.sessionOnly", false);
pref("network.cookie.thirdparty.nonsecureSessionOnly", false);
pref("network.cookie.leave-secure-alone", true);