2010-11-12 09:32:35 -08:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef nsCookieService_h__
|
|
|
|
#define nsCookieService_h__
|
|
|
|
|
2007-06-26 03:41:58 -07:00
|
|
|
#include "nsICookieService.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsICookieManager.h"
|
|
|
|
#include "nsICookieManager2.h"
|
|
|
|
#include "nsIObserver.h"
|
|
|
|
#include "nsWeakReference.h"
|
|
|
|
|
|
|
|
#include "nsCookie.h"
|
|
|
|
#include "nsString.h"
|
2009-12-19 15:55:56 -08:00
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsHashKeys.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsTHashtable.h"
|
2009-10-16 14:26:00 -07:00
|
|
|
#include "mozIStorageStatement.h"
|
2010-11-12 09:32:35 -08:00
|
|
|
#include "mozIStorageAsyncStatement.h"
|
2010-07-29 12:17:42 -07:00
|
|
|
#include "mozIStoragePendingStatement.h"
|
2009-10-16 14:26:00 -07:00
|
|
|
#include "mozIStorageConnection.h"
|
2010-07-29 12:17:42 -07:00
|
|
|
#include "mozIStorageRow.h"
|
2010-11-12 09:32:35 -08:00
|
|
|
#include "mozIStorageCompletionCallback.h"
|
|
|
|
#include "mozIStorageStatementCallback.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsICookiePermission;
|
2007-12-04 16:03:22 -08:00
|
|
|
class nsIEffectiveTLDService;
|
2010-01-12 10:29:20 -08:00
|
|
|
class nsIIDNService;
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsIPrefBranch;
|
|
|
|
class nsIObserverService;
|
|
|
|
class nsIURI;
|
|
|
|
class nsIChannel;
|
2010-11-12 09:32:35 -08:00
|
|
|
class nsIArray;
|
2010-07-29 13:43:34 -07:00
|
|
|
class mozIStorageService;
|
2010-10-19 09:37:03 -07:00
|
|
|
class mozIThirdPartyUtil;
|
2010-07-29 12:17:42 -07:00
|
|
|
class ReadCookieDBListener;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-03-25 16:02:28 -07:00
|
|
|
struct nsCookieAttributes;
|
|
|
|
struct nsListIter;
|
|
|
|
struct nsEnumerationData;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
class CookieServiceParent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-18 09:04:04 -07:00
|
|
|
// hash key class
|
|
|
|
class nsCookieKey : public PLDHashEntryHdr
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
typedef const nsCookieKey& KeyType;
|
|
|
|
typedef const nsCookieKey* KeyTypePointer;
|
|
|
|
|
|
|
|
nsCookieKey()
|
|
|
|
{}
|
|
|
|
|
|
|
|
nsCookieKey(const nsCString &baseDomain, uint32_t appId, bool inBrowser)
|
|
|
|
: mBaseDomain(baseDomain)
|
|
|
|
, mAppId(appId)
|
|
|
|
, mInBrowserElement(inBrowser)
|
|
|
|
{}
|
|
|
|
|
|
|
|
nsCookieKey(const KeyTypePointer other)
|
|
|
|
: mBaseDomain(other->mBaseDomain)
|
|
|
|
, mAppId(other->mAppId)
|
|
|
|
, mInBrowserElement(other->mInBrowserElement)
|
|
|
|
{}
|
|
|
|
|
2012-09-19 07:55:09 -07:00
|
|
|
nsCookieKey(const KeyType other)
|
2012-09-18 09:04:04 -07:00
|
|
|
: mBaseDomain(other.mBaseDomain)
|
|
|
|
, mAppId(other.mAppId)
|
|
|
|
, mInBrowserElement(other.mInBrowserElement)
|
|
|
|
{}
|
|
|
|
|
|
|
|
~nsCookieKey()
|
|
|
|
{}
|
|
|
|
|
|
|
|
bool KeyEquals(KeyTypePointer other) const
|
|
|
|
{
|
|
|
|
return mBaseDomain == other->mBaseDomain &&
|
|
|
|
mAppId == other->mAppId &&
|
|
|
|
mInBrowserElement == other->mInBrowserElement;
|
|
|
|
}
|
|
|
|
|
|
|
|
static KeyTypePointer KeyToPointer(KeyType aKey)
|
|
|
|
{
|
|
|
|
return &aKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PLDHashNumber HashKey(KeyTypePointer aKey)
|
|
|
|
{
|
|
|
|
// TODO: more efficient way to generate hash?
|
|
|
|
nsAutoCString temp(aKey->mBaseDomain);
|
|
|
|
temp.Append("#");
|
|
|
|
temp.Append(aKey->mAppId);
|
|
|
|
temp.Append("#");
|
|
|
|
temp.Append(aKey->mInBrowserElement ? 1 : 0);
|
|
|
|
return mozilla::HashString(temp);
|
|
|
|
}
|
|
|
|
|
|
|
|
enum { ALLOW_MEMMOVE = true };
|
|
|
|
|
|
|
|
nsCString mBaseDomain;
|
|
|
|
uint32_t mAppId;
|
|
|
|
bool mInBrowserElement;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Inherit from nsCookieKey so this can be stored in nsTHashTable
|
|
|
|
// TODO: why aren't we using nsClassHashTable<nsCookieKey, ArrayType>?
|
|
|
|
class nsCookieEntry : public nsCookieKey
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Hash methods
|
2009-12-19 15:55:56 -08:00
|
|
|
typedef nsTArray< nsRefPtr<nsCookie> > ArrayType;
|
|
|
|
typedef ArrayType::index_type IndexType;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-09-18 09:04:04 -07:00
|
|
|
nsCookieEntry(KeyTypePointer aKey)
|
|
|
|
: nsCookieKey(aKey)
|
|
|
|
{}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsCookieEntry(const nsCookieEntry& toCopy)
|
|
|
|
{
|
|
|
|
// if we end up here, things will break. nsTHashtable shouldn't
|
|
|
|
// allow this, since we set ALLOW_MEMMOVE to true.
|
|
|
|
NS_NOTREACHED("nsCookieEntry copy constructor is forbidden!");
|
|
|
|
}
|
|
|
|
|
|
|
|
~nsCookieEntry()
|
2012-09-18 09:04:04 -07:00
|
|
|
{}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-12-19 15:55:56 -08:00
|
|
|
inline ArrayType& GetCookies() { return mCookies; }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
private:
|
2009-12-19 15:55:56 -08:00
|
|
|
ArrayType mCookies;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
2012-09-18 09:04:04 -07:00
|
|
|
// encapsulates a (key, nsCookie) tuple for temporary storage purposes.
|
2010-07-29 12:17:42 -07:00
|
|
|
struct CookieDomainTuple
|
|
|
|
{
|
2012-09-18 09:04:04 -07:00
|
|
|
nsCookieKey key;
|
2010-07-29 12:17:42 -07:00
|
|
|
nsRefPtr<nsCookie> cookie;
|
|
|
|
};
|
|
|
|
|
2009-10-16 14:01:47 -07:00
|
|
|
// encapsulates in-memory and on-disk DB states, so we can
|
|
|
|
// conveniently switch state when entering or exiting private browsing.
|
|
|
|
struct DBState
|
|
|
|
{
|
2012-09-28 12:55:23 -07:00
|
|
|
DBState() : cookieCount(0), cookieOldestTime(INT64_MAX), corruptFlag(OK)
|
2010-11-12 09:32:35 -08:00
|
|
|
{
|
|
|
|
hostTable.Init();
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_INLINE_DECL_REFCOUNTING(DBState)
|
2009-10-16 14:01:47 -07:00
|
|
|
|
2010-11-12 09:32:35 -08:00
|
|
|
// State of the database connection.
|
|
|
|
enum CorruptFlag {
|
|
|
|
OK, // normal
|
|
|
|
CLOSING_FOR_REBUILD, // corruption detected, connection closing
|
|
|
|
REBUILDING // close complete, rebuilding database from memory
|
|
|
|
};
|
|
|
|
|
2009-10-16 14:01:47 -07:00
|
|
|
nsTHashtable<nsCookieEntry> hostTable;
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t cookieCount;
|
|
|
|
int64_t cookieOldestTime;
|
2010-11-12 09:32:35 -08:00
|
|
|
nsCOMPtr<nsIFile> cookieFile;
|
2009-10-16 14:01:47 -07:00
|
|
|
nsCOMPtr<mozIStorageConnection> dbConn;
|
2010-11-12 09:32:35 -08:00
|
|
|
nsCOMPtr<mozIStorageAsyncStatement> stmtInsert;
|
|
|
|
nsCOMPtr<mozIStorageAsyncStatement> stmtDelete;
|
|
|
|
nsCOMPtr<mozIStorageAsyncStatement> stmtUpdate;
|
2010-11-12 09:32:35 -08:00
|
|
|
CorruptFlag corruptFlag;
|
2010-07-29 12:17:42 -07:00
|
|
|
|
2010-07-29 12:17:42 -07:00
|
|
|
// Various parts representing asynchronous read state. These are useful
|
|
|
|
// while the background read is taking place.
|
2010-07-29 13:43:34 -07:00
|
|
|
nsCOMPtr<mozIStorageConnection> syncConn;
|
2010-07-29 12:17:42 -07:00
|
|
|
nsCOMPtr<mozIStorageStatement> stmtReadDomain;
|
2010-07-29 12:17:42 -07:00
|
|
|
nsCOMPtr<mozIStoragePendingStatement> pendingRead;
|
2010-07-29 12:17:42 -07:00
|
|
|
// The asynchronous read listener. This is a weak ref (storage has ownership)
|
|
|
|
// since it may need to outlive the DBState's database connection.
|
|
|
|
ReadCookieDBListener* readListener;
|
|
|
|
// An array of (baseDomain, cookie) tuples representing data read in
|
|
|
|
// asynchronously. This is merged into hostTable once read is complete.
|
2010-07-29 12:17:42 -07:00
|
|
|
nsTArray<CookieDomainTuple> hostArray;
|
2010-07-29 12:17:42 -07:00
|
|
|
// A hashset of baseDomains read in synchronously, while the async read is
|
|
|
|
// in flight. This is used to keep track of which data in hostArray is stale
|
|
|
|
// when the time comes to merge.
|
2012-09-18 09:04:04 -07:00
|
|
|
nsTHashtable<nsCookieKey> readSet;
|
2010-11-12 09:32:35 -08:00
|
|
|
|
|
|
|
// DB completion handlers.
|
|
|
|
nsCOMPtr<mozIStorageStatementCallback> insertListener;
|
|
|
|
nsCOMPtr<mozIStorageStatementCallback> updateListener;
|
|
|
|
nsCOMPtr<mozIStorageStatementCallback> removeListener;
|
|
|
|
nsCOMPtr<mozIStorageCompletionCallback> closeListener;
|
2009-10-16 14:01:47 -07:00
|
|
|
};
|
|
|
|
|
2010-06-07 12:32:12 -07:00
|
|
|
// these constants represent a decision about a cookie based on user prefs.
|
|
|
|
enum CookieStatus
|
|
|
|
{
|
|
|
|
STATUS_ACCEPTED,
|
|
|
|
STATUS_ACCEPT_SESSION,
|
|
|
|
STATUS_REJECTED,
|
|
|
|
// STATUS_REJECTED_WITH_ERROR indicates the cookie should be rejected because
|
|
|
|
// of an error (rather than something the user can control). this is used for
|
|
|
|
// notification purposes, since we only want to notify of rejections where
|
|
|
|
// the user can do something about it (e.g. whitelist the site).
|
|
|
|
STATUS_REJECTED_WITH_ERROR
|
|
|
|
};
|
|
|
|
|
2010-11-12 09:32:35 -08:00
|
|
|
// Result codes for TryInitDB() and Read().
|
|
|
|
enum OpenDBResult
|
|
|
|
{
|
|
|
|
RESULT_OK,
|
|
|
|
RESULT_RETRY,
|
|
|
|
RESULT_FAILURE
|
|
|
|
};
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/******************************************************************************
|
|
|
|
* nsCookieService:
|
|
|
|
* class declaration
|
|
|
|
******************************************************************************/
|
|
|
|
|
2007-06-26 03:41:58 -07:00
|
|
|
class nsCookieService : public nsICookieService
|
2007-03-22 10:30:00 -07:00
|
|
|
, public nsICookieManager2
|
|
|
|
, public nsIObserver
|
|
|
|
, public nsSupportsWeakReference
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
NS_DECL_NSICOOKIESERVICE
|
|
|
|
NS_DECL_NSICOOKIEMANAGER
|
|
|
|
NS_DECL_NSICOOKIEMANAGER2
|
|
|
|
|
|
|
|
nsCookieService();
|
|
|
|
virtual ~nsCookieService();
|
2010-03-25 16:02:28 -07:00
|
|
|
static nsICookieService* GetXPCOMSingleton();
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult Init();
|
|
|
|
|
2012-09-27 14:37:28 -07:00
|
|
|
/**
|
|
|
|
* Start watching the observer service for messages indicating that an app has
|
|
|
|
* been uninstalled. When an app is uninstalled, we get the cookie service
|
|
|
|
* (thus instantiating it, if necessary) and clear all the cookies for that
|
|
|
|
* app.
|
|
|
|
*/
|
2012-09-28 17:03:00 -07:00
|
|
|
static void AppClearDataObserverInit();
|
2012-09-27 14:37:28 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
void PrefChanged(nsIPrefBranch *aPrefBranch);
|
2010-11-12 09:32:35 -08:00
|
|
|
void InitDBStates();
|
2010-11-12 09:32:35 -08:00
|
|
|
OpenDBResult TryInitDB(bool aDeleteExistingDB);
|
2007-06-17 14:52:22 -07:00
|
|
|
nsresult CreateTable();
|
2010-11-12 09:32:35 -08:00
|
|
|
void CloseDBStates();
|
2013-07-23 13:41:23 -07:00
|
|
|
void CleanupCachedStatements();
|
|
|
|
void CleanupDefaultDBConnection();
|
2010-11-12 09:32:35 -08:00
|
|
|
void HandleDBClosed(DBState* aDBState);
|
|
|
|
void HandleCorruptDB(DBState* aDBState);
|
|
|
|
void RebuildCorruptDB(DBState* aDBState);
|
2010-11-12 09:32:35 -08:00
|
|
|
OpenDBResult Read();
|
2010-07-29 12:17:42 -07:00
|
|
|
template<class T> nsCookie* GetCookieFromRow(T &aRow);
|
|
|
|
void AsyncReadComplete();
|
2011-09-28 23:19:26 -07:00
|
|
|
void CancelAsyncRead(bool aPurgeReadSet);
|
2012-09-18 09:04:04 -07:00
|
|
|
void EnsureReadDomain(const nsCookieKey &aKey);
|
2010-07-29 12:17:42 -07:00
|
|
|
void EnsureReadComplete();
|
2010-01-12 10:29:20 -08:00
|
|
|
nsresult NormalizeHost(nsCString &aHost);
|
2011-09-28 23:19:26 -07:00
|
|
|
nsresult GetBaseDomain(nsIURI *aHostURI, nsCString &aBaseDomain, bool &aRequireHostMatch);
|
2009-12-19 15:55:56 -08:00
|
|
|
nsresult GetBaseDomainFromHost(const nsACString &aHost, nsCString &aBaseDomain);
|
2010-09-16 13:21:12 -07:00
|
|
|
nsresult GetCookieStringCommon(nsIURI *aHostURI, nsIChannel *aChannel, bool aHttpBound, char** aCookie);
|
2012-02-08 10:37:07 -08:00
|
|
|
void GetCookieStringInternal(nsIURI *aHostURI, bool aIsForeign, bool aHttpBound, uint32_t aAppId, bool aInBrowserElement, bool aIsPrivate, nsCString &aCookie);
|
2010-09-16 13:21:12 -07:00
|
|
|
nsresult SetCookieStringCommon(nsIURI *aHostURI, const char *aCookieHeader, const char *aServerTime, nsIChannel *aChannel, bool aFromHttp);
|
2012-02-01 02:20:01 -08:00
|
|
|
void SetCookieStringInternal(nsIURI *aHostURI, bool aIsForeign, nsDependentCString &aCookieHeader, const nsCString &aServerTime, bool aFromHttp, uint32_t aAppId, bool aInBrowserElement, bool aIsPrivate, nsIChannel* aChannel);
|
|
|
|
bool SetCookieInternal(nsIURI *aHostURI, const nsCookieKey& aKey, bool aRequireHostMatch, CookieStatus aStatus, nsDependentCString &aCookieHeader, int64_t aServerTime, bool aFromHttp, nsIChannel* aChannel);
|
2012-09-18 09:04:04 -07:00
|
|
|
void AddInternal(const nsCookieKey& aKey, nsCookie *aCookie, int64_t aCurrentTimeInUsec, nsIURI *aHostURI, const char *aCookieHeader, bool aFromHttp);
|
2010-03-12 07:18:38 -08:00
|
|
|
void RemoveCookieFromList(const nsListIter &aIter, mozIStorageBindingParamsArray *aParamsArray = NULL);
|
2012-09-18 09:04:04 -07:00
|
|
|
void AddCookieToList(const nsCookieKey& aKey, nsCookie *aCookie, DBState *aDBState, mozIStorageBindingParamsArray *aParamsArray, bool aWriteToDB = true);
|
2012-08-22 08:56:38 -07:00
|
|
|
void UpdateCookieInList(nsCookie *aCookie, int64_t aLastAccessed, mozIStorageBindingParamsArray *aParamsArray);
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool GetTokenValue(nsASingleFragmentCString::const_char_iterator &aIter, nsASingleFragmentCString::const_char_iterator &aEndIter, nsDependentCSubstring &aTokenString, nsDependentCSubstring &aTokenValue, bool &aEqualsFound);
|
|
|
|
static bool ParseAttributes(nsDependentCString &aCookieHeader, nsCookieAttributes &aCookie);
|
2012-09-18 09:04:04 -07:00
|
|
|
bool RequireThirdPartyCheck();
|
|
|
|
CookieStatus CheckPrefs(nsIURI *aHostURI, bool aIsForeign, bool aRequireHostMatch, const char *aCookieHeader);
|
2011-09-28 23:19:26 -07:00
|
|
|
bool CheckDomain(nsCookieAttributes &aCookie, nsIURI *aHostURI, const nsCString &aBaseDomain, bool aRequireHostMatch);
|
|
|
|
static bool CheckPath(nsCookieAttributes &aCookie, nsIURI *aHostURI);
|
2012-08-22 08:56:38 -07:00
|
|
|
static bool GetExpiry(nsCookieAttributes &aCookie, int64_t aServerTime, int64_t aCurrentTime);
|
2007-03-22 10:30:00 -07:00
|
|
|
void RemoveAllFromMemory();
|
2012-08-22 08:56:38 -07:00
|
|
|
already_AddRefed<nsIArray> PurgeCookies(int64_t aCurrentTimeInUsec);
|
2012-09-18 09:04:04 -07:00
|
|
|
bool FindCookie(const nsCookieKey& aKey, const nsAFlatCString &aHost, const nsAFlatCString &aName, const nsAFlatCString &aPath, nsListIter &aIter);
|
2012-08-22 08:56:38 -07:00
|
|
|
static void FindStaleCookie(nsCookieEntry *aEntry, int64_t aCurrentTime, nsListIter &aIter);
|
2007-03-22 10:30:00 -07:00
|
|
|
void NotifyRejected(nsIURI *aHostURI);
|
2013-06-21 22:11:12 -07:00
|
|
|
void NotifyThirdParty(nsIURI *aHostURI, bool aAccepted, nsIChannel *aChannel);
|
2009-12-15 14:21:28 -08:00
|
|
|
void NotifyChanged(nsISupports *aSubject, const PRUnichar *aData);
|
2010-11-02 10:46:19 -07:00
|
|
|
void NotifyPurged(nsICookie2* aCookie);
|
2010-11-12 09:32:35 -08:00
|
|
|
already_AddRefed<nsIArray> CreatePurgeList(nsICookie2* aCookie);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-09-27 14:17:08 -07:00
|
|
|
/**
|
|
|
|
* This method is used to iterate the cookie hash table and select the ones
|
|
|
|
* that are part of a specific app.
|
|
|
|
*/
|
|
|
|
static PLDHashOperator GetCookiesForApp(nsCookieEntry* entry, void* arg);
|
|
|
|
|
2012-09-27 14:37:02 -07:00
|
|
|
/**
|
|
|
|
* This method is a helper that allows calling nsICookieManager::Remove()
|
|
|
|
* with appId/inBrowserElement parameters.
|
|
|
|
* NOTE: this could be added to a public interface if we happen to need it.
|
|
|
|
*/
|
|
|
|
nsresult Remove(const nsACString& aHost, uint32_t aAppId,
|
|
|
|
bool aInBrowserElement, const nsACString& aName,
|
|
|
|
const nsACString& aPath, bool aBlocked);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
2009-10-16 14:01:47 -07:00
|
|
|
// cached members.
|
2007-12-04 16:03:22 -08:00
|
|
|
nsCOMPtr<nsIObserverService> mObserverService;
|
|
|
|
nsCOMPtr<nsICookiePermission> mPermissionService;
|
2010-10-19 09:37:03 -07:00
|
|
|
nsCOMPtr<mozIThirdPartyUtil> mThirdPartyUtil;
|
2007-12-04 16:03:22 -08:00
|
|
|
nsCOMPtr<nsIEffectiveTLDService> mTLDService;
|
2010-01-12 10:29:20 -08:00
|
|
|
nsCOMPtr<nsIIDNService> mIDNService;
|
2010-07-29 13:43:34 -07:00
|
|
|
nsCOMPtr<mozIStorageService> mStorageService;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-10-16 14:01:47 -07:00
|
|
|
// we have two separate DB states: one for normal browsing and one for
|
2012-02-08 10:37:07 -08:00
|
|
|
// private browsing, switching between them on a per-cookie-request basis.
|
|
|
|
// this state encapsulates both the in-memory table and the on-disk DB.
|
2009-10-16 14:01:47 -07:00
|
|
|
// note that the private states' dbConn should always be null - we never
|
|
|
|
// want to be dealing with the on-disk DB when in private browsing.
|
|
|
|
DBState *mDBState;
|
2010-11-12 09:32:35 -08:00
|
|
|
nsRefPtr<DBState> mDefaultDBState;
|
|
|
|
nsRefPtr<DBState> mPrivateDBState;
|
2010-06-21 17:50:35 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// cached prefs
|
2013-02-22 08:16:01 -08:00
|
|
|
uint8_t mCookieBehavior; // BEHAVIOR_{ACCEPT, REJECTFOREIGN, REJECT, LIMITFOREIGN}
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mThirdPartySession;
|
2012-08-22 08:56:38 -07:00
|
|
|
uint16_t mMaxNumberOfCookies;
|
|
|
|
uint16_t mMaxCookiesPerHost;
|
|
|
|
int64_t mCookiePurgeAge;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-07-29 12:17:42 -07:00
|
|
|
// friends!
|
2009-12-15 14:21:28 -08:00
|
|
|
friend PLDHashOperator purgeCookiesCallback(nsCookieEntry *aEntry, void *aArg);
|
2010-11-12 09:32:35 -08:00
|
|
|
friend class DBListenerErrorHandler;
|
2010-07-29 12:17:42 -07:00
|
|
|
friend class ReadCookieDBListener;
|
2010-11-12 09:32:35 -08:00
|
|
|
friend class CloseCookieDBListener;
|
2010-03-25 16:02:28 -07:00
|
|
|
|
|
|
|
static nsCookieService* GetSingleton();
|
|
|
|
friend class mozilla::net::CookieServiceParent;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsCookieService_h__
|