mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1624146 - Cookie code refactoring - part 14 - Fix the namespaces, r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D67763 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
0f16f86d52
commit
78a4aecdfd
@ -47,16 +47,16 @@ already_AddRefed<Cookie> Cookie::Create(
|
||||
int64_t aCreationTime, bool aIsSession, bool aIsSecure, bool aIsHttpOnly,
|
||||
const OriginAttributes& aOriginAttributes, int32_t aSameSite,
|
||||
int32_t aRawSameSite) {
|
||||
mozilla::net::CookieStruct cookieData(
|
||||
nsCString(aName), nsCString(aValue), nsCString(aHost), nsCString(aPath),
|
||||
aExpiry, aLastAccessed, aCreationTime, aIsHttpOnly, aIsSession, aIsSecure,
|
||||
aSameSite, aRawSameSite);
|
||||
CookieStruct cookieData(nsCString(aName), nsCString(aValue), nsCString(aHost),
|
||||
nsCString(aPath), aExpiry, aLastAccessed,
|
||||
aCreationTime, aIsHttpOnly, aIsSession, aIsSecure,
|
||||
aSameSite, aRawSameSite);
|
||||
|
||||
return Create(cookieData, aOriginAttributes);
|
||||
}
|
||||
|
||||
already_AddRefed<Cookie> Cookie::Create(
|
||||
const mozilla::net::CookieStruct& aCookieData,
|
||||
const CookieStruct& aCookieData,
|
||||
const OriginAttributes& aOriginAttributes) {
|
||||
RefPtr<Cookie> cookie = new Cookie(aCookieData, aOriginAttributes);
|
||||
|
||||
@ -98,8 +98,7 @@ bool Cookie::IsStale() const {
|
||||
int64_t currentTimeInUsec = PR_Now();
|
||||
|
||||
return currentTimeInUsec - LastAccessed() >
|
||||
mozilla::StaticPrefs::network_cookie_staleThreshold() *
|
||||
PR_USEC_PER_SEC;
|
||||
StaticPrefs::network_cookie_staleThreshold() * PR_USEC_PER_SEC;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@ -157,7 +156,7 @@ NS_IMETHODIMP Cookie::GetLastAccessed(int64_t* aTime) {
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP Cookie::GetSameSite(int32_t* aSameSite) {
|
||||
if (mozilla::StaticPrefs::network_cookie_sameSite_laxByDefault()) {
|
||||
if (StaticPrefs::network_cookie_sameSite_laxByDefault()) {
|
||||
*aSameSite = SameSite();
|
||||
} else {
|
||||
*aSameSite = RawSameSite();
|
||||
@ -215,7 +214,7 @@ Cookie::GetExpires(uint64_t* aExpires) {
|
||||
}
|
||||
|
||||
// static
|
||||
bool Cookie::ValidateRawSame(const mozilla::net::CookieStruct& aCookieData) {
|
||||
bool Cookie::ValidateRawSame(const CookieStruct& aCookieData) {
|
||||
return aCookieData.rawSameSite() == aCookieData.sameSite() ||
|
||||
aCookieData.rawSameSite() == nsICookie::SAMESITE_NONE;
|
||||
}
|
||||
|
@ -40,13 +40,13 @@ class Cookie final : public nsICookie {
|
||||
|
||||
private:
|
||||
// for internal use only. see Cookie::Create().
|
||||
Cookie(const mozilla::net::CookieStruct& aCookieData,
|
||||
Cookie(const CookieStruct& aCookieData,
|
||||
const OriginAttributes& aOriginAttributes)
|
||||
: mData(aCookieData), mOriginAttributes(aOriginAttributes) {}
|
||||
|
||||
public:
|
||||
// Returns false if rawSameSite has an invalid value, compared to sameSite.
|
||||
static bool ValidateRawSame(const mozilla::net::CookieStruct& aCookieData);
|
||||
static bool ValidateRawSame(const CookieStruct& aCookieData);
|
||||
|
||||
// Generate a unique and monotonically increasing creation time. See comment
|
||||
// in Cookie.cpp.
|
||||
@ -62,7 +62,7 @@ class Cookie final : public nsICookie {
|
||||
int32_t aRawSameSite);
|
||||
|
||||
static already_AddRefed<Cookie> Create(
|
||||
const mozilla::net::CookieStruct& aCookieData,
|
||||
const CookieStruct& aCookieData,
|
||||
const OriginAttributes& aOriginAttributes);
|
||||
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
@ -103,7 +103,7 @@ class Cookie final : public nsICookie {
|
||||
|
||||
bool IsStale() const;
|
||||
|
||||
const mozilla::net::CookieStruct& ToIPC() const { return mData; }
|
||||
const CookieStruct& ToIPC() const { return mData; }
|
||||
|
||||
protected:
|
||||
virtual ~Cookie() = default;
|
||||
@ -112,8 +112,8 @@ class Cookie final : public nsICookie {
|
||||
// member variables
|
||||
//
|
||||
// Please update SizeOfIncludingThis if this strategy changes.
|
||||
mozilla::net::CookieStruct mData;
|
||||
mozilla::OriginAttributes mOriginAttributes;
|
||||
CookieStruct mData;
|
||||
OriginAttributes mOriginAttributes;
|
||||
nsCString mFilePathCache;
|
||||
};
|
||||
|
||||
|
@ -117,7 +117,7 @@ CookieJarSettings::CookieJarSettings(uint32_t aCookieBehavior, State aState)
|
||||
CookieJarSettings::~CookieJarSettings() {
|
||||
if (!NS_IsMainThread() && !mCookiePermissions.IsEmpty()) {
|
||||
nsCOMPtr<nsIEventTarget> systemGroupEventTarget =
|
||||
mozilla::SystemGroup::EventTargetFor(mozilla::TaskCategory::Other);
|
||||
SystemGroup::EventTargetFor(TaskCategory::Other);
|
||||
MOZ_ASSERT(systemGroupEventTarget);
|
||||
|
||||
RefPtr<Runnable> r = new ReleaseCookiePermissions(mCookiePermissions);
|
||||
|
@ -42,10 +42,10 @@ class CookieKey : public PLDHashEntryHdr {
|
||||
nsAutoCString suffix;
|
||||
aKey->mOriginAttributes.CreateSuffix(suffix);
|
||||
temp.Append(suffix);
|
||||
return mozilla::HashString(temp);
|
||||
return HashString(temp);
|
||||
}
|
||||
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
|
||||
size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const {
|
||||
return mBaseDomain.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ namespace net {
|
||||
static const bool kDefaultPolicy = true;
|
||||
|
||||
namespace {
|
||||
mozilla::StaticRefPtr<CookiePermission> gSingleton;
|
||||
StaticRefPtr<CookiePermission> gSingleton;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(CookiePermission, nsICookiePermission)
|
||||
|
@ -276,7 +276,7 @@ class InsertCookieDBListener final : public DBListenerErrorHandler {
|
||||
}
|
||||
|
||||
// This notification is just for testing.
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (os) {
|
||||
os->NotifyObservers(nullptr, "cookie-saved-on-disk", nullptr);
|
||||
}
|
||||
@ -394,7 +394,7 @@ void CookiePersistentStorage::NotifyChangedInternal(nsISupports* aSubject,
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (os) {
|
||||
os->NotifyObservers(aSubject, "session-cookie-changed", aData);
|
||||
}
|
||||
@ -422,8 +422,7 @@ void CookiePersistentStorage::RemoveAllInternal() {
|
||||
|
||||
void CookiePersistentStorage::WriteCookieToDB(
|
||||
const nsACString& aBaseDomain, const OriginAttributes& aOriginAttributes,
|
||||
mozilla::net::Cookie* aCookie,
|
||||
mozIStorageBindingParamsArray* aParamsArray) {
|
||||
Cookie* aCookie, mozIStorageBindingParamsArray* aParamsArray) {
|
||||
if (mDBConn) {
|
||||
mozIStorageAsyncStatement* stmt = mStmtInsert;
|
||||
nsCOMPtr<mozIStorageBindingParamsArray> paramsArray(aParamsArray);
|
||||
@ -484,8 +483,7 @@ void CookiePersistentStorage::HandleCorruptDB() {
|
||||
}
|
||||
|
||||
void CookiePersistentStorage::RemoveCookiesWithOriginAttributes(
|
||||
const mozilla::OriginAttributesPattern& aPattern,
|
||||
const nsACString& aBaseDomain) {
|
||||
const OriginAttributesPattern& aPattern, const nsACString& aBaseDomain) {
|
||||
mozStorageTransaction transaction(mDBConn, false);
|
||||
|
||||
CookieStorage::RemoveCookiesWithOriginAttributes(aPattern, aBaseDomain);
|
||||
@ -496,7 +494,7 @@ void CookiePersistentStorage::RemoveCookiesWithOriginAttributes(
|
||||
|
||||
void CookiePersistentStorage::RemoveCookiesFromExactHost(
|
||||
const nsACString& aHost, const nsACString& aBaseDomain,
|
||||
const mozilla::OriginAttributesPattern& aPattern) {
|
||||
const OriginAttributesPattern& aPattern) {
|
||||
mozStorageTransaction transaction(mDBConn, false);
|
||||
|
||||
CookieStorage::RemoveCookiesFromExactHost(aHost, aBaseDomain, aPattern);
|
||||
@ -1627,7 +1625,7 @@ void CookiePersistentStorage::RebuildCorruptDB() {
|
||||
NS_ASSERTION(mCorruptFlag == CookiePersistentStorage::CLOSING_FOR_REBUILD,
|
||||
"should be in CLOSING_FOR_REBUILD state");
|
||||
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
|
||||
mCorruptFlag = CookiePersistentStorage::REBUILDING;
|
||||
|
||||
@ -1643,8 +1641,7 @@ void CookiePersistentStorage::RebuildCorruptDB() {
|
||||
|
||||
nsCOMPtr<nsIRunnable> innerRunnable = NS_NewRunnableFunction(
|
||||
"RebuildCorruptDB.TryInitDBComplete", [self, result] {
|
||||
nsCOMPtr<nsIObserverService> os =
|
||||
mozilla::services::GetObserverService();
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (result != RESULT_OK) {
|
||||
// We're done. Reset our DB connection and statements, and
|
||||
// notify of closure.
|
||||
@ -1716,7 +1713,7 @@ void CookiePersistentStorage::HandleDBClosed() {
|
||||
COOKIE_LOGSTRING(LogLevel::Debug,
|
||||
("HandleDBClosed(): CookieStorage %p closed", this));
|
||||
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
|
||||
switch (mCorruptFlag) {
|
||||
case CookiePersistentStorage::OK: {
|
||||
@ -1825,7 +1822,7 @@ CookiePersistentStorage::OpenDBResult CookiePersistentStorage::Read() {
|
||||
}
|
||||
|
||||
// Extract data from a single result row and create an Cookie.
|
||||
mozilla::UniquePtr<CookieStruct> CookiePersistentStorage::GetCookieFromRow(
|
||||
UniquePtr<CookieStruct> CookiePersistentStorage::GetCookieFromRow(
|
||||
mozIStorageStatement* aRow) {
|
||||
nsCString name, value, host, path;
|
||||
DebugOnly<nsresult> rv = aRow->GetUTF8String(IDX_NAME, name);
|
||||
@ -1846,9 +1843,9 @@ mozilla::UniquePtr<CookieStruct> CookiePersistentStorage::GetCookieFromRow(
|
||||
int32_t rawSameSite = aRow->AsInt32(IDX_RAW_SAME_SITE);
|
||||
|
||||
// Create a new constCookie and assign the data.
|
||||
return mozilla::MakeUnique<CookieStruct>(
|
||||
name, value, host, path, expiry, lastAccessed, creationTime, isHttpOnly,
|
||||
false, isSecure, sameSite, rawSameSite);
|
||||
return MakeUnique<CookieStruct>(name, value, host, path, expiry, lastAccessed,
|
||||
creationTime, isHttpOnly, false, isSecure,
|
||||
sameSite, rawSameSite);
|
||||
}
|
||||
|
||||
void CookiePersistentStorage::EnsureReadComplete() {
|
||||
@ -1942,9 +1939,9 @@ void CookiePersistentStorage::InitDBConn() {
|
||||
|
||||
COOKIE_LOGSTRING(LogLevel::Debug,
|
||||
("InitDBConn(): mInitializedDBConn = true"));
|
||||
mEndInitDBConn = mozilla::TimeStamp::Now();
|
||||
mEndInitDBConn = TimeStamp::Now();
|
||||
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (os) {
|
||||
os->NotifyObservers(nullptr, "cookie-db-read", nullptr);
|
||||
mReadArray.Clear();
|
||||
|
@ -33,12 +33,12 @@ class CookiePersistentStorage final : public CookieStorage {
|
||||
void HandleCorruptDB();
|
||||
|
||||
void RemoveCookiesWithOriginAttributes(
|
||||
const mozilla::OriginAttributesPattern& aPattern,
|
||||
const OriginAttributesPattern& aPattern,
|
||||
const nsACString& aBaseDomain) override;
|
||||
|
||||
void RemoveCookiesFromExactHost(
|
||||
const nsACString& aHost, const nsACString& aBaseDomain,
|
||||
const mozilla::OriginAttributesPattern& aPattern) override;
|
||||
const OriginAttributesPattern& aPattern) override;
|
||||
|
||||
void StaleCookies(const nsTArray<Cookie*>& aCookieList,
|
||||
int64_t aCurrentTimeInUsec) override;
|
||||
@ -78,7 +78,7 @@ class CookiePersistentStorage final : public CookieStorage {
|
||||
|
||||
void WriteCookieToDB(const nsACString& aBaseDomain,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
mozilla::net::Cookie* aCookie,
|
||||
Cookie* aCookie,
|
||||
mozIStorageBindingParamsArray* aParamsArray) override;
|
||||
|
||||
void RemoveAllInternal() override;
|
||||
@ -109,7 +109,7 @@ class CookiePersistentStorage final : public CookieStorage {
|
||||
nsresult CreateTableForSchemaVersion6();
|
||||
nsresult CreateTableForSchemaVersion5();
|
||||
|
||||
mozilla::UniquePtr<CookieStruct> GetCookieFromRow(mozIStorageStatement* aRow);
|
||||
UniquePtr<CookieStruct> GetCookieFromRow(mozIStorageStatement* aRow);
|
||||
|
||||
nsCOMPtr<nsIThread> mThread;
|
||||
nsCOMPtr<mozIStorageService> mStorageService;
|
||||
@ -119,17 +119,17 @@ class CookiePersistentStorage final : public CookieStorage {
|
||||
struct CookieDomainTuple {
|
||||
CookieKey key;
|
||||
OriginAttributes originAttributes;
|
||||
mozilla::UniquePtr<mozilla::net::CookieStruct> cookie;
|
||||
UniquePtr<CookieStruct> cookie;
|
||||
};
|
||||
|
||||
// thread
|
||||
mozilla::TimeStamp mEndInitDBConn;
|
||||
TimeStamp mEndInitDBConn;
|
||||
nsTArray<CookieDomainTuple> mReadArray;
|
||||
|
||||
mozilla::Monitor mMonitor;
|
||||
Monitor mMonitor;
|
||||
|
||||
mozilla::Atomic<bool> mInitialized;
|
||||
mozilla::Atomic<bool> mInitializedDBConn;
|
||||
Atomic<bool> mInitialized;
|
||||
Atomic<bool> mInitializedDBConn;
|
||||
|
||||
nsCOMPtr<nsIFile> mCookieFile;
|
||||
nsCOMPtr<mozIStorageConnection> mDBConn;
|
||||
|
@ -30,7 +30,7 @@ class CookiePrivateStorage final : public CookieStorage {
|
||||
|
||||
void WriteCookieToDB(const nsACString& aBaseDomain,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
mozilla::net::Cookie* aCookie,
|
||||
Cookie* aCookie,
|
||||
mozIStorageBindingParamsArray* aParamsArray) override{};
|
||||
|
||||
void RemoveAllInternal() override {}
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "ThirdPartyUtil.h"
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
using mozilla::OriginAttributes;
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
@ -88,8 +87,7 @@ CookieServiceChild::CookieServiceChild() {
|
||||
PrefChanged(prefBranch);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
mozilla::services::GetObserverService();
|
||||
nsCOMPtr<nsIObserverService> observerService = services::GetObserverService();
|
||||
if (observerService) {
|
||||
observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
|
||||
}
|
||||
@ -141,7 +139,7 @@ void CookieServiceChild::TrackCookieLoad(nsIChannel* aChannel) {
|
||||
aChannel->GetURI(getter_AddRefs(uri));
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->LoadInfo();
|
||||
|
||||
mozilla::OriginAttributes attrs = loadInfo->GetOriginAttributes();
|
||||
OriginAttributes attrs = loadInfo->GetOriginAttributes();
|
||||
StoragePrincipalHelper::PrepareOriginAttributes(aChannel, attrs);
|
||||
URIParams uriParams;
|
||||
SerializeURI(uri, uriParams);
|
||||
@ -155,13 +153,13 @@ void CookieServiceChild::TrackCookieLoad(nsIChannel* aChannel) {
|
||||
rejectedReason, isSafeTopLevelNav, isSameSiteForeign, attrs);
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult CookieServiceChild::RecvRemoveAll() {
|
||||
IPCResult CookieServiceChild::RecvRemoveAll() {
|
||||
mCookiesMap.Clear();
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult CookieServiceChild::RecvRemoveCookie(
|
||||
const CookieStruct& aCookie, const OriginAttributes& aAttrs) {
|
||||
IPCResult CookieServiceChild::RecvRemoveCookie(const CookieStruct& aCookie,
|
||||
const OriginAttributes& aAttrs) {
|
||||
nsCString baseDomain;
|
||||
CookieCommons::GetBaseDomainFromHost(mTLDService, aCookie.host(), baseDomain);
|
||||
CookieKey key(baseDomain, aAttrs);
|
||||
@ -185,8 +183,8 @@ mozilla::ipc::IPCResult CookieServiceChild::RecvRemoveCookie(
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult CookieServiceChild::RecvAddCookie(
|
||||
const CookieStruct& aCookie, const OriginAttributes& aAttrs) {
|
||||
IPCResult CookieServiceChild::RecvAddCookie(const CookieStruct& aCookie,
|
||||
const OriginAttributes& aAttrs) {
|
||||
RefPtr<Cookie> cookie = Cookie::Create(
|
||||
aCookie.name(), aCookie.value(), aCookie.host(), aCookie.path(),
|
||||
aCookie.expiry(), aCookie.lastAccessed(), aCookie.creationTime(),
|
||||
@ -196,7 +194,7 @@ mozilla::ipc::IPCResult CookieServiceChild::RecvAddCookie(
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult CookieServiceChild::RecvRemoveBatchDeletedCookies(
|
||||
IPCResult CookieServiceChild::RecvRemoveBatchDeletedCookies(
|
||||
nsTArray<CookieStruct>&& aCookiesList,
|
||||
nsTArray<OriginAttributes>&& aAttrsList) {
|
||||
MOZ_ASSERT(aCookiesList.Length() == aAttrsList.Length());
|
||||
@ -207,7 +205,7 @@ mozilla::ipc::IPCResult CookieServiceChild::RecvRemoveBatchDeletedCookies(
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult CookieServiceChild::RecvTrackCookiesLoad(
|
||||
IPCResult CookieServiceChild::RecvTrackCookiesLoad(
|
||||
nsTArray<CookieStruct>&& aCookiesList, const OriginAttributes& aAttrs) {
|
||||
for (uint32_t i = 0; i < aCookiesList.Length(); i++) {
|
||||
RefPtr<Cookie> cookie = Cookie::Create(
|
||||
@ -254,7 +252,7 @@ void CookieServiceChild::GetCookieStringFromCookieHashTable(
|
||||
nsAutoCString baseDomain;
|
||||
|
||||
nsCOMPtr<nsILoadInfo> loadInfo;
|
||||
mozilla::OriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (aChannel) {
|
||||
loadInfo = aChannel->LoadInfo();
|
||||
attrs = loadInfo->GetOriginAttributes();
|
||||
@ -356,7 +354,7 @@ uint32_t CookieServiceChild::CountCookiesFromHashTable(
|
||||
}
|
||||
|
||||
void CookieServiceChild::SetCookieInternal(
|
||||
const CookieStruct& aCookieData, const mozilla::OriginAttributes& aAttrs,
|
||||
const CookieStruct& aCookieData, const OriginAttributes& aAttrs,
|
||||
nsIChannel* aChannel, bool aFromHttp,
|
||||
nsICookiePermission* aPermissionService) {
|
||||
int64_t currentTimeInUsec = PR_Now();
|
||||
@ -486,7 +484,7 @@ nsresult CookieServiceChild::SetCookieStringInternal(
|
||||
SerializeURI(aHostURI, hostURIParams);
|
||||
|
||||
Maybe<URIParams> channelURIParams;
|
||||
mozilla::OriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (aChannel) {
|
||||
nsCOMPtr<nsIURI> channelURI;
|
||||
aChannel->GetURI(getter_AddRefs(channelURI));
|
||||
@ -590,7 +588,7 @@ CookieServiceChild::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
mCookieTimer = nullptr;
|
||||
}
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
mozilla::services::GetObserverService();
|
||||
services::GetObserverService();
|
||||
if (observerService) {
|
||||
observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
|
||||
}
|
||||
|
@ -75,8 +75,8 @@ class CookieServiceChild : public PCookieServiceChild,
|
||||
void RecordDocumentCookie(Cookie* aCookie, const OriginAttributes& aAttrs);
|
||||
|
||||
void SetCookieInternal(const CookieStruct& aCookieData,
|
||||
const mozilla::OriginAttributes& aAttrs,
|
||||
nsIChannel* aChannel, bool aFromHttp,
|
||||
const OriginAttributes& aAttrs, nsIChannel* aChannel,
|
||||
bool aFromHttp,
|
||||
nsICookiePermission* aPermissionService);
|
||||
|
||||
uint32_t CountCookiesFromHashTable(const nsCString& aBaseDomain,
|
||||
|
@ -21,7 +21,6 @@ using namespace mozilla::ipc;
|
||||
using mozilla::BasePrincipal;
|
||||
using mozilla::OriginAttributes;
|
||||
using mozilla::dom::PContentParent;
|
||||
using mozilla::net::NeckoParent;
|
||||
|
||||
namespace {
|
||||
|
||||
@ -105,7 +104,7 @@ void CookieServiceParent::TrackCookieLoad(nsIChannel* aChannel) {
|
||||
aChannel->GetURI(getter_AddRefs(uri));
|
||||
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->LoadInfo();
|
||||
mozilla::OriginAttributes attrs = loadInfo->GetOriginAttributes();
|
||||
OriginAttributes attrs = loadInfo->GetOriginAttributes();
|
||||
bool isSafeTopLevelNav = NS_IsSafeTopLevelNav(aChannel);
|
||||
bool aIsSameSiteForeign = NS_IsSameSiteForeign(aChannel, uri);
|
||||
|
||||
@ -146,7 +145,7 @@ void CookieServiceParent::SerialializeCookieList(
|
||||
}
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult CookieServiceParent::RecvPrepareCookieList(
|
||||
IPCResult CookieServiceParent::RecvPrepareCookieList(
|
||||
const URIParams& aHost, const bool& aIsForeign,
|
||||
const bool& aIsThirdPartyTrackingResource,
|
||||
const bool& aIsThirdPartySocialTrackingResource,
|
||||
@ -176,7 +175,7 @@ void CookieServiceParent::ActorDestroy(ActorDestroyReason aWhy) {
|
||||
// non-refcounted class.
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult CookieServiceParent::RecvSetCookieString(
|
||||
IPCResult CookieServiceParent::RecvSetCookieString(
|
||||
const URIParams& aHost, const Maybe<URIParams>& aChannelURI,
|
||||
const Maybe<LoadInfoArgs>& aLoadInfoArgs, const bool& aIsForeign,
|
||||
const bool& aIsThirdPartyTrackingResource,
|
||||
|
@ -245,8 +245,8 @@ const nsTArray<RefPtr<Cookie>>* CookieStorage::GetCookiesFromHost(
|
||||
}
|
||||
|
||||
void CookieStorage::GetCookiesWithOriginAttributes(
|
||||
const mozilla::OriginAttributesPattern& aPattern,
|
||||
const nsACString& aBaseDomain, nsTArray<RefPtr<nsICookie>>& aResult) {
|
||||
const OriginAttributesPattern& aPattern, const nsACString& aBaseDomain,
|
||||
nsTArray<RefPtr<nsICookie>>& aResult) {
|
||||
for (auto iter = mHostTable.Iter(); !iter.Done(); iter.Next()) {
|
||||
CookieEntry* entry = iter.Get();
|
||||
|
||||
@ -286,8 +286,7 @@ void CookieStorage::RemoveCookie(const nsACString& aBaseDomain,
|
||||
}
|
||||
|
||||
void CookieStorage::RemoveCookiesWithOriginAttributes(
|
||||
const mozilla::OriginAttributesPattern& aPattern,
|
||||
const nsACString& aBaseDomain) {
|
||||
const OriginAttributesPattern& aPattern, const nsACString& aBaseDomain) {
|
||||
// Iterate the hash table of CookieEntry.
|
||||
for (auto iter = mHostTable.Iter(); !iter.Done(); iter.Next()) {
|
||||
CookieEntry* entry = iter.Get();
|
||||
@ -320,7 +319,7 @@ void CookieStorage::RemoveCookiesWithOriginAttributes(
|
||||
|
||||
void CookieStorage::RemoveCookiesFromExactHost(
|
||||
const nsACString& aHost, const nsACString& aBaseDomain,
|
||||
const mozilla::OriginAttributesPattern& aPattern) {
|
||||
const OriginAttributesPattern& aPattern) {
|
||||
// Iterate the hash table of CookieEntry.
|
||||
for (auto iter = mHostTable.Iter(); !iter.Done(); iter.Next()) {
|
||||
CookieEntry* entry = iter.Get();
|
||||
@ -374,7 +373,7 @@ void CookieStorage::RemoveAll() {
|
||||
// cookies.
|
||||
void CookieStorage::NotifyChanged(nsISupports* aSubject, const char16_t* aData,
|
||||
bool aOldCookieIsSession, bool aFromHttp) {
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (!os) {
|
||||
return;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ struct CookieListIter {
|
||||
: entry(aEntry), index(aIndex) {}
|
||||
|
||||
// get the Cookie * the iterator currently points to.
|
||||
Cookie* Cookie() const { return entry->GetCookies()[index]; }
|
||||
mozilla::net::Cookie* Cookie() const { return entry->GetCookies()[index]; }
|
||||
|
||||
CookieEntry* entry;
|
||||
CookieEntry::IndexType index;
|
||||
@ -91,9 +91,9 @@ class CookieStorage : public nsIObserver, public nsSupportsWeakReference {
|
||||
const nsTArray<RefPtr<Cookie>>* GetCookiesFromHost(
|
||||
const nsACString& aBaseDomain, const OriginAttributes& aOriginAttributes);
|
||||
|
||||
void GetCookiesWithOriginAttributes(
|
||||
const mozilla::OriginAttributesPattern& aPattern,
|
||||
const nsACString& aBaseDomain, nsTArray<RefPtr<nsICookie>>& aResult);
|
||||
void GetCookiesWithOriginAttributes(const OriginAttributesPattern& aPattern,
|
||||
const nsACString& aBaseDomain,
|
||||
nsTArray<RefPtr<nsICookie>>& aResult);
|
||||
|
||||
void RemoveCookie(const nsACString& aBaseDomain,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
@ -101,12 +101,11 @@ class CookieStorage : public nsIObserver, public nsSupportsWeakReference {
|
||||
const nsACString& aPath);
|
||||
|
||||
virtual void RemoveCookiesWithOriginAttributes(
|
||||
const mozilla::OriginAttributesPattern& aPattern,
|
||||
const nsACString& aBaseDomain);
|
||||
const OriginAttributesPattern& aPattern, const nsACString& aBaseDomain);
|
||||
|
||||
virtual void RemoveCookiesFromExactHost(
|
||||
const nsACString& aHost, const nsACString& aBaseDomain,
|
||||
const mozilla::OriginAttributesPattern& aPattern);
|
||||
const OriginAttributesPattern& aPattern);
|
||||
|
||||
void RemoveAll();
|
||||
|
||||
@ -133,7 +132,7 @@ class CookieStorage : public nsIObserver, public nsSupportsWeakReference {
|
||||
|
||||
void AddCookieToList(const nsACString& aBaseDomain,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
mozilla::net::Cookie* aCookie,
|
||||
Cookie* aCookie,
|
||||
mozIStorageBindingParamsArray* aParamsArray,
|
||||
bool aWriteToDB = true);
|
||||
|
||||
@ -145,7 +144,7 @@ class CookieStorage : public nsIObserver, public nsSupportsWeakReference {
|
||||
|
||||
virtual void WriteCookieToDB(const nsACString& aBaseDomain,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
mozilla::net::Cookie* aCookie,
|
||||
Cookie* aCookie,
|
||||
mozIStorageBindingParamsArray* aParamsArray) = 0;
|
||||
|
||||
virtual void RemoveAllInternal() = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user