Bug 1547114 - Part 6: Convert network.cookie.lifetimePolicy into a static pref; r=baku

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ehsan Akhgari 2019-04-26 15:42:01 +00:00
Родитель c8fea1ecad
Коммит 31a8a7053e
5 изменённых файлов: 16 добавлений и 23 удалений

Просмотреть файл

@ -344,9 +344,6 @@ nsContentUtils::UserInteractionObserver*
uint32_t nsContentUtils::sHandlingInputTimeout = 1000;
uint32_t nsContentUtils::sCookiesLifetimePolicy =
nsICookieService::ACCEPT_NORMALLY;
nsHtml5StringParser* nsContentUtils::sHTMLFragmentParser = nullptr;
nsIParser* nsContentUtils::sXMLFragmentParser = nullptr;
nsIFragmentContentSink* nsContentUtils::sXMLFragmentSink = nullptr;
@ -679,10 +676,6 @@ nsresult nsContentUtils::Init() {
&sSendPerformanceTimingNotifications,
"dom.performance.enable_notify_performance_timing", false);
Preferences::AddUintVarCache(&sCookiesLifetimePolicy,
"network.cookie.lifetimePolicy",
nsICookieService::ACCEPT_NORMALLY);
Preferences::AddBoolVarCache(&sDoNotTrackEnabled,
"privacy.donottrackheader.enabled", false);
@ -8284,7 +8277,7 @@ nsContentUtils::StorageAccess nsContentUtils::StorageAllowedForServiceWorker(
void nsContentUtils::GetCookieLifetimePolicyFromCookieSettings(
nsICookieSettings* aCookieSettings, nsIPrincipal* aPrincipal,
uint32_t* aLifetimePolicy) {
*aLifetimePolicy = sCookiesLifetimePolicy;
*aLifetimePolicy = StaticPrefs::network_cookie_lifetimePolicy();
if (aCookieSettings) {
uint32_t cookiePermission = 0;

Просмотреть файл

@ -3360,11 +3360,6 @@ class nsContentUtils {
static bool HighPriorityEventPendingForTopLevelDocumentBeforeContentfulPaint(
Document* aDocument);
/**
* Gets the global cookie lifetime policy.
*/
static uint32_t GetCookieLifetimePolicy() { return sCookiesLifetimePolicy; }
private:
static bool InitializeEventTable();
@ -3513,7 +3508,6 @@ class nsContentUtils {
#endif
static bool sIsBytecodeCacheEnabled;
static int32_t sBytecodeCacheStrategy;
static uint32_t sCookiesLifetimePolicy;
static bool sAntiTrackingControlCenterUIEnabled;
static int32_t sPrivacyMaxInnerWidth;

Просмотреть файл

@ -31,6 +31,8 @@
************************ nsCookiePermission ********************
****************************************************************/
using namespace mozilla;
static const bool kDefaultPolicy = true;
static const nsLiteralCString kPermissionType(NS_LITERAL_CSTRING("cookie"));
@ -108,7 +110,7 @@ nsCookiePermission::CanSetCookie(nsIURI *aURI, nsIChannel *aChannel,
// now we need to figure out what type of accept policy we're dealing with
// if we accept cookies normally, just bail and return
if (nsContentUtils::GetCookieLifetimePolicy() ==
if (StaticPrefs::network_cookie_lifetimePolicy() ==
nsICookieService::ACCEPT_NORMALLY) {
*aResult = true;
return NS_OK;
@ -121,7 +123,7 @@ nsCookiePermission::CanSetCookie(nsIURI *aURI, nsIChannel *aChannel,
// We are accepting the cookie, but,
// if it's not a session cookie, we may have to limit its lifetime.
if (!*aIsSession && delta > 0) {
if (nsContentUtils::GetCookieLifetimePolicy() ==
if (StaticPrefs::network_cookie_lifetimePolicy() ==
nsICookieService::ACCEPT_SESSION) {
// limit lifetime to session
*aIsSession = true;

Просмотреть файл

@ -1964,6 +1964,17 @@ VARCACHE_PREF(
RelaxedAtomicInt32, 0
)
// Cookie lifetime policy. Possible values:
// 0 - accept all cookies
// 1 - deprecated. don't use it.
// 2 - accept as session cookies
// 3 - deprecated. don't use it.
VARCACHE_PREF(
"network.cookie.lifetimePolicy",
network_cookie_lifetimePolicy,
RelaxedAtomicInt32, 0
)
// Enables the predictive service.
VARCACHE_PREF(
"network.predictor.enabled",

Просмотреть файл

@ -2409,13 +2409,6 @@ pref("network.cookie.thirdparty.sessionOnly", false);
pref("network.cookie.thirdparty.nonsecureSessionOnly", false);
pref("network.cookie.same-site.enabled", true); // Honor the SameSite cookie attribute
// Cookie lifetime policy. Possible values:
// 0 - accept all cookies
// 1 - deprecated. don't use it.
// 2 - accept as session cookies
// 3 - deprecated. don't use it.
pref("network.cookie.lifetimePolicy", 0);
// The interval in seconds to move the cookies in the child process.
// Set to 0 to disable moving the cookies.
pref("network.cookie.move.interval_sec", 10);