2010-11-12 20:32:35 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04: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/. */
|
2003-10-11 03:09:18 +04:00
|
|
|
|
|
|
|
#ifndef nsCookieService_h__
|
|
|
|
#define nsCookieService_h__
|
|
|
|
|
2007-06-26 14:41:58 +04:00
|
|
|
#include "nsICookieService.h"
|
2003-10-11 03:09:18 +04:00
|
|
|
#include "nsICookieManager.h"
|
|
|
|
#include "nsICookieManager2.h"
|
|
|
|
#include "nsIObserver.h"
|
|
|
|
#include "nsWeakReference.h"
|
|
|
|
|
|
|
|
#include "nsCookie.h"
|
|
|
|
#include "nsString.h"
|
2009-12-20 02:55:56 +03:00
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsHashKeys.h"
|
2003-10-22 10:53:19 +04:00
|
|
|
#include "nsTHashtable.h"
|
2009-10-17 01:26:00 +04:00
|
|
|
#include "mozIStorageStatement.h"
|
2010-11-12 20:32:35 +03:00
|
|
|
#include "mozIStorageAsyncStatement.h"
|
2010-07-29 23:17:42 +04:00
|
|
|
#include "mozIStoragePendingStatement.h"
|
2009-10-17 01:26:00 +04:00
|
|
|
#include "mozIStorageConnection.h"
|
2010-07-29 23:17:42 +04:00
|
|
|
#include "mozIStorageRow.h"
|
2010-11-12 20:32:35 +03:00
|
|
|
#include "mozIStorageCompletionCallback.h"
|
|
|
|
#include "mozIStorageStatementCallback.h"
|
2003-10-11 03:09:18 +04:00
|
|
|
|
|
|
|
class nsICookiePermission;
|
2007-12-05 03:03:22 +03:00
|
|
|
class nsIEffectiveTLDService;
|
2010-01-12 21:29:20 +03:00
|
|
|
class nsIIDNService;
|
2003-10-11 03:09:18 +04:00
|
|
|
class nsIPrefBranch;
|
|
|
|
class nsIObserverService;
|
|
|
|
class nsIURI;
|
|
|
|
class nsIChannel;
|
2010-11-12 20:32:35 +03:00
|
|
|
class nsIArray;
|
2010-07-30 00:43:34 +04:00
|
|
|
class mozIStorageService;
|
2010-10-19 20:37:03 +04:00
|
|
|
class mozIThirdPartyUtil;
|
2010-07-29 23:17:42 +04:00
|
|
|
class ReadCookieDBListener;
|
2003-10-11 03:09:18 +04:00
|
|
|
|
2010-03-26 02:02:28 +03:00
|
|
|
struct nsCookieAttributes;
|
|
|
|
struct nsListIter;
|
|
|
|
struct nsEnumerationData;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
class CookieServiceParent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-18 20:04:04 +04: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 18:55:09 +04:00
|
|
|
nsCookieKey(const KeyType other)
|
2012-09-18 20:04:04 +04: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
|
2003-10-22 10:53:19 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Hash methods
|
2009-12-20 02:55:56 +03:00
|
|
|
typedef nsTArray< nsRefPtr<nsCookie> > ArrayType;
|
|
|
|
typedef ArrayType::index_type IndexType;
|
2003-10-22 10:53:19 +04:00
|
|
|
|
2012-09-18 20:04:04 +04:00
|
|
|
nsCookieEntry(KeyTypePointer aKey)
|
|
|
|
: nsCookieKey(aKey)
|
|
|
|
{}
|
2003-10-22 10:53:19 +04: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 20:04:04 +04:00
|
|
|
{}
|
2003-10-22 10:53:19 +04:00
|
|
|
|
2009-12-20 02:55:56 +03:00
|
|
|
inline ArrayType& GetCookies() { return mCookies; }
|
2003-10-22 10:53:19 +04:00
|
|
|
|
|
|
|
private:
|
2009-12-20 02:55:56 +03:00
|
|
|
ArrayType mCookies;
|
2003-10-22 10:53:19 +04:00
|
|
|
};
|
|
|
|
|
2012-09-18 20:04:04 +04:00
|
|
|
// encapsulates a (key, nsCookie) tuple for temporary storage purposes.
|
2010-07-29 23:17:42 +04:00
|
|
|
struct CookieDomainTuple
|
|
|
|
{
|
2012-09-18 20:04:04 +04:00
|
|
|
nsCookieKey key;
|
2010-07-29 23:17:42 +04:00
|
|
|
nsRefPtr<nsCookie> cookie;
|
|
|
|
};
|
|
|
|
|
2009-10-17 01:01:47 +04: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 23:55:23 +04:00
|
|
|
DBState() : cookieCount(0), cookieOldestTime(INT64_MAX), corruptFlag(OK)
|
2010-11-12 20:32:35 +03:00
|
|
|
{
|
|
|
|
hostTable.Init();
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_INLINE_DECL_REFCOUNTING(DBState)
|
2009-10-17 01:01:47 +04:00
|
|
|
|
2010-11-12 20:32:35 +03: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-17 01:01:47 +04:00
|
|
|
nsTHashtable<nsCookieEntry> hostTable;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t cookieCount;
|
|
|
|
int64_t cookieOldestTime;
|
2010-11-12 20:32:35 +03:00
|
|
|
nsCOMPtr<nsIFile> cookieFile;
|
2009-10-17 01:01:47 +04:00
|
|
|
nsCOMPtr<mozIStorageConnection> dbConn;
|
2010-11-12 20:32:35 +03:00
|
|
|
nsCOMPtr<mozIStorageAsyncStatement> stmtInsert;
|
|
|
|
nsCOMPtr<mozIStorageAsyncStatement> stmtDelete;
|
|
|
|
nsCOMPtr<mozIStorageAsyncStatement> stmtUpdate;
|
2010-11-12 20:32:35 +03:00
|
|
|
CorruptFlag corruptFlag;
|
2010-07-29 23:17:42 +04:00
|
|
|
|
2010-07-29 23:17:42 +04:00
|
|
|
// Various parts representing asynchronous read state. These are useful
|
|
|
|
// while the background read is taking place.
|
2010-07-30 00:43:34 +04:00
|
|
|
nsCOMPtr<mozIStorageConnection> syncConn;
|
2010-07-29 23:17:42 +04:00
|
|
|
nsCOMPtr<mozIStorageStatement> stmtReadDomain;
|
2010-07-29 23:17:42 +04:00
|
|
|
nsCOMPtr<mozIStoragePendingStatement> pendingRead;
|
2010-07-29 23:17:42 +04: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 23:17:42 +04:00
|
|
|
nsTArray<CookieDomainTuple> hostArray;
|
2010-07-29 23:17:42 +04: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 20:04:04 +04:00
|
|
|
nsTHashtable<nsCookieKey> readSet;
|
2010-11-12 20:32:35 +03:00
|
|
|
|
|
|
|
// DB completion handlers.
|
|
|
|
nsCOMPtr<mozIStorageStatementCallback> insertListener;
|
|
|
|
nsCOMPtr<mozIStorageStatementCallback> updateListener;
|
|
|
|
nsCOMPtr<mozIStorageStatementCallback> removeListener;
|
|
|
|
nsCOMPtr<mozIStorageCompletionCallback> closeListener;
|
2009-10-17 01:01:47 +04:00
|
|
|
};
|
|
|
|
|
2010-06-07 23:32:12 +04: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 20:32:35 +03:00
|
|
|
// Result codes for TryInitDB() and Read().
|
|
|
|
enum OpenDBResult
|
|
|
|
{
|
|
|
|
RESULT_OK,
|
|
|
|
RESULT_RETRY,
|
|
|
|
RESULT_FAILURE
|
|
|
|
};
|
|
|
|
|
2003-10-11 03:09:18 +04:00
|
|
|
/******************************************************************************
|
|
|
|
* nsCookieService:
|
|
|
|
* class declaration
|
|
|
|
******************************************************************************/
|
|
|
|
|
2007-06-26 14:41:58 +04:00
|
|
|
class nsCookieService : public nsICookieService
|
2003-10-11 03:09:18 +04: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-26 02:02:28 +03:00
|
|
|
static nsICookieService* GetXPCOMSingleton();
|
2003-10-22 10:53:19 +04:00
|
|
|
nsresult Init();
|
2003-10-11 03:09:18 +04:00
|
|
|
|
2012-09-28 01:37:28 +04: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-29 04:03:00 +04:00
|
|
|
static void AppClearDataObserverInit();
|
2012-09-28 01:37:28 +04:00
|
|
|
|
2003-10-11 03:09:18 +04:00
|
|
|
protected:
|
2003-11-14 09:43:08 +03:00
|
|
|
void PrefChanged(nsIPrefBranch *aPrefBranch);
|
2010-11-12 20:32:35 +03:00
|
|
|
void InitDBStates();
|
2010-11-12 20:32:35 +03:00
|
|
|
OpenDBResult TryInitDB(bool aDeleteExistingDB);
|
2007-06-18 01:52:22 +04:00
|
|
|
nsresult CreateTable();
|
2010-11-12 20:32:35 +03:00
|
|
|
void CloseDBStates();
|
2013-07-24 00:41:23 +04:00
|
|
|
void CleanupCachedStatements();
|
|
|
|
void CleanupDefaultDBConnection();
|
2010-11-12 20:32:35 +03:00
|
|
|
void HandleDBClosed(DBState* aDBState);
|
|
|
|
void HandleCorruptDB(DBState* aDBState);
|
|
|
|
void RebuildCorruptDB(DBState* aDBState);
|
2010-11-12 20:32:35 +03:00
|
|
|
OpenDBResult Read();
|
2010-07-29 23:17:42 +04:00
|
|
|
template<class T> nsCookie* GetCookieFromRow(T &aRow);
|
|
|
|
void AsyncReadComplete();
|
2011-09-29 10:19:26 +04:00
|
|
|
void CancelAsyncRead(bool aPurgeReadSet);
|
2012-09-18 20:04:04 +04:00
|
|
|
void EnsureReadDomain(const nsCookieKey &aKey);
|
2010-07-29 23:17:42 +04:00
|
|
|
void EnsureReadComplete();
|
2010-01-12 21:29:20 +03:00
|
|
|
nsresult NormalizeHost(nsCString &aHost);
|
2011-09-29 10:19:26 +04:00
|
|
|
nsresult GetBaseDomain(nsIURI *aHostURI, nsCString &aBaseDomain, bool &aRequireHostMatch);
|
2009-12-20 02:55:56 +03:00
|
|
|
nsresult GetBaseDomainFromHost(const nsACString &aHost, nsCString &aBaseDomain);
|
2010-09-17 00:21:12 +04:00
|
|
|
nsresult GetCookieStringCommon(nsIURI *aHostURI, nsIChannel *aChannel, bool aHttpBound, char** aCookie);
|
2012-02-08 22:37:07 +04:00
|
|
|
void GetCookieStringInternal(nsIURI *aHostURI, bool aIsForeign, bool aHttpBound, uint32_t aAppId, bool aInBrowserElement, bool aIsPrivate, nsCString &aCookie);
|
2010-09-17 00:21:12 +04:00
|
|
|
nsresult SetCookieStringCommon(nsIURI *aHostURI, const char *aCookieHeader, const char *aServerTime, nsIChannel *aChannel, bool aFromHttp);
|
2012-02-01 14:20:01 +04: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 20:04:04 +04:00
|
|
|
void AddInternal(const nsCookieKey& aKey, nsCookie *aCookie, int64_t aCurrentTimeInUsec, nsIURI *aHostURI, const char *aCookieHeader, bool aFromHttp);
|
2010-03-12 18:18:38 +03:00
|
|
|
void RemoveCookieFromList(const nsListIter &aIter, mozIStorageBindingParamsArray *aParamsArray = NULL);
|
2012-09-18 20:04:04 +04:00
|
|
|
void AddCookieToList(const nsCookieKey& aKey, nsCookie *aCookie, DBState *aDBState, mozIStorageBindingParamsArray *aParamsArray, bool aWriteToDB = true);
|
2012-08-22 19:56:38 +04:00
|
|
|
void UpdateCookieInList(nsCookie *aCookie, int64_t aLastAccessed, mozIStorageBindingParamsArray *aParamsArray);
|
2011-09-29 10:19:26 +04: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 20:04:04 +04:00
|
|
|
bool RequireThirdPartyCheck();
|
|
|
|
CookieStatus CheckPrefs(nsIURI *aHostURI, bool aIsForeign, bool aRequireHostMatch, const char *aCookieHeader);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool CheckDomain(nsCookieAttributes &aCookie, nsIURI *aHostURI, const nsCString &aBaseDomain, bool aRequireHostMatch);
|
|
|
|
static bool CheckPath(nsCookieAttributes &aCookie, nsIURI *aHostURI);
|
2012-08-22 19:56:38 +04:00
|
|
|
static bool GetExpiry(nsCookieAttributes &aCookie, int64_t aServerTime, int64_t aCurrentTime);
|
2003-10-11 03:09:18 +04:00
|
|
|
void RemoveAllFromMemory();
|
2012-08-22 19:56:38 +04:00
|
|
|
already_AddRefed<nsIArray> PurgeCookies(int64_t aCurrentTimeInUsec);
|
2012-09-18 20:04:04 +04:00
|
|
|
bool FindCookie(const nsCookieKey& aKey, const nsAFlatCString &aHost, const nsAFlatCString &aName, const nsAFlatCString &aPath, nsListIter &aIter);
|
2012-08-22 19:56:38 +04:00
|
|
|
static void FindStaleCookie(nsCookieEntry *aEntry, int64_t aCurrentTime, nsListIter &aIter);
|
2003-10-22 10:53:19 +04:00
|
|
|
void NotifyRejected(nsIURI *aHostURI);
|
2013-06-22 09:11:12 +04:00
|
|
|
void NotifyThirdParty(nsIURI *aHostURI, bool aAccepted, nsIChannel *aChannel);
|
2009-12-16 01:21:28 +03:00
|
|
|
void NotifyChanged(nsISupports *aSubject, const PRUnichar *aData);
|
2010-11-02 20:46:19 +03:00
|
|
|
void NotifyPurged(nsICookie2* aCookie);
|
2010-11-12 20:32:35 +03:00
|
|
|
already_AddRefed<nsIArray> CreatePurgeList(nsICookie2* aCookie);
|
2003-10-11 03:09:18 +04:00
|
|
|
|
2012-09-28 01:17:08 +04: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-28 01:37:02 +04: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);
|
|
|
|
|
2003-10-11 03:09:18 +04:00
|
|
|
protected:
|
2009-10-17 01:01:47 +04:00
|
|
|
// cached members.
|
2007-12-05 03:03:22 +03:00
|
|
|
nsCOMPtr<nsIObserverService> mObserverService;
|
|
|
|
nsCOMPtr<nsICookiePermission> mPermissionService;
|
2010-10-19 20:37:03 +04:00
|
|
|
nsCOMPtr<mozIThirdPartyUtil> mThirdPartyUtil;
|
2007-12-05 03:03:22 +03:00
|
|
|
nsCOMPtr<nsIEffectiveTLDService> mTLDService;
|
2010-01-12 21:29:20 +03:00
|
|
|
nsCOMPtr<nsIIDNService> mIDNService;
|
2010-07-30 00:43:34 +04:00
|
|
|
nsCOMPtr<mozIStorageService> mStorageService;
|
2003-10-11 03:09:18 +04:00
|
|
|
|
2009-10-17 01:01:47 +04:00
|
|
|
// we have two separate DB states: one for normal browsing and one for
|
2012-02-08 22:37:07 +04: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-17 01:01:47 +04: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 20:32:35 +03:00
|
|
|
nsRefPtr<DBState> mDefaultDBState;
|
|
|
|
nsRefPtr<DBState> mPrivateDBState;
|
2010-06-22 04:50:35 +04:00
|
|
|
|
2003-10-11 03:09:18 +04:00
|
|
|
// cached prefs
|
2013-02-22 20:16:01 +04:00
|
|
|
uint8_t mCookieBehavior; // BEHAVIOR_{ACCEPT, REJECTFOREIGN, REJECT, LIMITFOREIGN}
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mThirdPartySession;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint16_t mMaxNumberOfCookies;
|
|
|
|
uint16_t mMaxCookiesPerHost;
|
|
|
|
int64_t mCookiePurgeAge;
|
2003-10-11 03:09:18 +04:00
|
|
|
|
2010-07-29 23:17:42 +04:00
|
|
|
// friends!
|
2009-12-16 01:21:28 +03:00
|
|
|
friend PLDHashOperator purgeCookiesCallback(nsCookieEntry *aEntry, void *aArg);
|
2010-11-12 20:32:35 +03:00
|
|
|
friend class DBListenerErrorHandler;
|
2010-07-29 23:17:42 +04:00
|
|
|
friend class ReadCookieDBListener;
|
2010-11-12 20:32:35 +03:00
|
|
|
friend class CloseCookieDBListener;
|
2010-03-26 02:02:28 +03:00
|
|
|
|
|
|
|
static nsCookieService* GetSingleton();
|
|
|
|
friend class mozilla::net::CookieServiceParent;
|
2003-10-11 03:09:18 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsCookieService_h__
|