mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1551826 - Use StaticPrefs for network.cookie.staleThreshold in nsCookie, r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D31218 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
289365e128
commit
4e58d1f5a3
@ -2182,6 +2182,13 @@ VARCACHE_PREF(
|
||||
RelaxedAtomicInt32, 0
|
||||
)
|
||||
|
||||
// Stale threshold for cookies in seconds.
|
||||
VARCACHE_PREF(
|
||||
"network.cookie.staleThreshold",
|
||||
network_cookie_staleThreshold,
|
||||
uint32_t, 60
|
||||
)
|
||||
|
||||
// Cookie lifetime policy. Possible values:
|
||||
// 0 - accept all cookies
|
||||
// 1 - deprecated. don't use it.
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "mozilla/Encoding.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "mozilla/StaticPrefs.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCookie.h"
|
||||
#include <stdlib.h>
|
||||
@ -126,7 +127,8 @@ bool nsCookie::IsStale() const {
|
||||
int64_t currentTimeInUsec = PR_Now();
|
||||
|
||||
return currentTimeInUsec - LastAccessed() >
|
||||
CookieStaleThreshold() * PR_USEC_PER_SEC;
|
||||
mozilla::StaticPrefs::network_cookie_staleThreshold() *
|
||||
PR_USEC_PER_SEC;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
using mozilla::OriginAttributes;
|
||||
|
||||
@ -55,17 +54,6 @@ class nsCookie final : public nsICookie2 {
|
||||
mOriginAttributes(aOriginAttributes),
|
||||
mSameSite(aSameSite) {}
|
||||
|
||||
static int CookieStaleThreshold() {
|
||||
static bool initialized = false;
|
||||
static int value = 60;
|
||||
if (!initialized) {
|
||||
mozilla::Preferences::AddIntVarCache(&value,
|
||||
"network.cookie.staleThreshold", 60);
|
||||
initialized = true;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public:
|
||||
// Generate a unique and monotonically increasing creation time. See comment
|
||||
// in nsCookie.cpp.
|
||||
|
Loading…
Reference in New Issue
Block a user