зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1896241 - Refactor cookie code to use nsTArray<RefPtr<Cookie>>& instead of nsTArray<Cookie*>& r=edgul,cookie-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D210666
This commit is contained in:
Родитель
19543b6fd9
Коммит
86114ddaf2
|
@ -621,8 +621,8 @@ void CookiePersistentStorage::MaybeStoreCookiesToDB(
|
|||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
}
|
||||
|
||||
void CookiePersistentStorage::StaleCookies(const nsTArray<Cookie*>& aCookieList,
|
||||
int64_t aCurrentTimeInUsec) {
|
||||
void CookiePersistentStorage::StaleCookies(
|
||||
const nsTArray<RefPtr<Cookie>>& aCookieList, int64_t aCurrentTimeInUsec) {
|
||||
// Create an array of parameters to bind to our update statement. Batching
|
||||
// is OK here since we're updating cookies with no interleaved operations.
|
||||
nsCOMPtr<mozIStorageBindingParamsArray> paramsArray;
|
||||
|
|
|
@ -41,7 +41,7 @@ class CookiePersistentStorage final : public CookieStorage {
|
|||
const nsACString& aHost, const nsACString& aBaseDomain,
|
||||
const OriginAttributesPattern& aPattern) override;
|
||||
|
||||
void StaleCookies(const nsTArray<Cookie*>& aCookieList,
|
||||
void StaleCookies(const nsTArray<RefPtr<Cookie>>& aCookieList,
|
||||
int64_t aCurrentTimeInUsec) override;
|
||||
|
||||
void Close() override;
|
||||
|
|
|
@ -17,8 +17,8 @@ already_AddRefed<CookiePrivateStorage> CookiePrivateStorage::Create() {
|
|||
return storage.forget();
|
||||
}
|
||||
|
||||
void CookiePrivateStorage::StaleCookies(const nsTArray<Cookie*>& aCookieList,
|
||||
int64_t aCurrentTimeInUsec) {
|
||||
void CookiePrivateStorage::StaleCookies(
|
||||
const nsTArray<RefPtr<Cookie>>& aCookieList, int64_t aCurrentTimeInUsec) {
|
||||
int32_t count = aCookieList.Length();
|
||||
for (int32_t i = 0; i < count; ++i) {
|
||||
Cookie* cookie = aCookieList.ElementAt(i);
|
||||
|
|
|
@ -17,7 +17,7 @@ class CookiePrivateStorage final : public CookieStorage {
|
|||
public:
|
||||
static already_AddRefed<CookiePrivateStorage> Create();
|
||||
|
||||
void StaleCookies(const nsTArray<Cookie*>& aCookieList,
|
||||
void StaleCookies(const nsTArray<RefPtr<Cookie>>& aCookieList,
|
||||
int64_t aCurrentTimeInUsec) override;
|
||||
|
||||
void Close() override{};
|
||||
|
|
|
@ -145,7 +145,7 @@ constexpr auto SAMESITE_MDN_URL =
|
|||
|
||||
namespace {
|
||||
|
||||
void ComposeCookieString(nsTArray<Cookie*>& aCookieList,
|
||||
void ComposeCookieString(nsTArray<RefPtr<Cookie>>& aCookieList,
|
||||
nsACString& aCookieString) {
|
||||
for (Cookie* cookie : aCookieList) {
|
||||
// check if we have anything to write
|
||||
|
@ -421,7 +421,7 @@ CookieService::GetCookieStringFromDocument(Document* aDocument,
|
|||
principals.AppendElement(aDocument->PartitionedPrincipal());
|
||||
}
|
||||
|
||||
nsTArray<Cookie*> cookieList;
|
||||
nsTArray<RefPtr<Cookie>> cookieList;
|
||||
|
||||
for (auto& principal : principals) {
|
||||
if (!CookieCommons::IsSchemeSupported(principal)) {
|
||||
|
@ -580,7 +580,7 @@ CookieService::GetCookieStringFromHttp(nsIURI* aHostURI, nsIChannel* aChannel,
|
|||
MOZ_ASSERT(!partitionedOriginAttributes.mPartitionKey.IsEmpty());
|
||||
}
|
||||
|
||||
AutoTArray<Cookie*, 8> foundCookieList;
|
||||
AutoTArray<RefPtr<Cookie>, 8> foundCookieList;
|
||||
GetCookiesForURI(
|
||||
aHostURI, aChannel, result.contains(ThirdPartyAnalysis::IsForeign),
|
||||
result.contains(ThirdPartyAnalysis::IsThirdPartyTrackingResource),
|
||||
|
@ -1039,7 +1039,7 @@ void CookieService::GetCookiesForURI(
|
|||
bool aHadCrossSiteRedirects, bool aHttpBound,
|
||||
bool aAllowSecureCookiesToInsecureOrigin,
|
||||
const nsTArray<OriginAttributes>& aOriginAttrsList,
|
||||
nsTArray<Cookie*>& aCookieList) {
|
||||
nsTArray<RefPtr<Cookie>>& aCookieList) {
|
||||
NS_ASSERTION(aHostURI, "null host!");
|
||||
|
||||
if (!CookieCommons::IsSchemeSupported(aHostURI)) {
|
||||
|
|
|
@ -89,7 +89,7 @@ class CookieService final : public nsICookieService,
|
|||
bool aHttpBound,
|
||||
bool aAllowSecureCookiesToInsecureOrigin,
|
||||
const nsTArray<OriginAttributes>& aOriginAttrsList,
|
||||
nsTArray<Cookie*>& aCookieList);
|
||||
nsTArray<RefPtr<Cookie>>& aCookieList);
|
||||
|
||||
/**
|
||||
* This method is a helper that allows calling nsICookieManager::Remove()
|
||||
|
|
|
@ -166,7 +166,7 @@ void CookieServiceParent::TrackCookieLoad(nsIChannel* aChannel) {
|
|||
}
|
||||
|
||||
// Send matching cookies to Child.
|
||||
nsTArray<Cookie*> foundCookieList;
|
||||
nsTArray<RefPtr<Cookie>> foundCookieList;
|
||||
mCookieService->GetCookiesForURI(
|
||||
uri, aChannel, result.contains(ThirdPartyAnalysis::IsForeign),
|
||||
result.contains(ThirdPartyAnalysis::IsThirdPartyTrackingResource),
|
||||
|
@ -201,7 +201,7 @@ void CookieServiceParent::UpdateCookieInContentList(
|
|||
|
||||
// static
|
||||
void CookieServiceParent::SerializeCookieListTable(
|
||||
const nsTArray<Cookie*>& aFoundCookieList,
|
||||
const nsTArray<RefPtr<Cookie>>& aFoundCookieList,
|
||||
nsTArray<CookieStructTable>& aCookiesListTable, nsIURI* aHostURI) {
|
||||
nsTHashMap<nsCStringHashKey, CookieStructTable*> cookieListTable;
|
||||
|
||||
|
@ -252,7 +252,7 @@ IPCResult CookieServiceParent::RecvGetCookieList(
|
|||
UpdateCookieInContentList(aHost, attrs);
|
||||
}
|
||||
|
||||
nsTArray<Cookie*> foundCookieList;
|
||||
nsTArray<RefPtr<Cookie>> foundCookieList;
|
||||
// Note: passing nullptr as aChannel to GetCookiesForURI() here is fine since
|
||||
// this argument is only used for proper reporting of cookie loads, but the
|
||||
// child process already does the necessary reporting in this case for us.
|
||||
|
|
|
@ -74,7 +74,7 @@ class CookieServiceParent : public PCookieServiceParent {
|
|||
GetCookieListResolver&& aResolve);
|
||||
|
||||
static void SerializeCookieListTable(
|
||||
const nsTArray<Cookie*>& aFoundCookieList,
|
||||
const nsTArray<RefPtr<Cookie>>& aFoundCookieList,
|
||||
nsTArray<CookieStructTable>& aCookiesListTable, nsIURI* aHostURI);
|
||||
|
||||
nsCOMPtr<nsIEffectiveTLDService> mTLDService;
|
||||
|
|
|
@ -130,7 +130,7 @@ class CookieStorage : public nsIObserver, public nsSupportsWeakReference {
|
|||
static void CreateOrUpdatePurgeList(nsCOMPtr<nsIArray>& aPurgedList,
|
||||
nsICookie* aCookie);
|
||||
|
||||
virtual void StaleCookies(const nsTArray<Cookie*>& aCookieList,
|
||||
virtual void StaleCookies(const nsTArray<RefPtr<Cookie>>& aCookieList,
|
||||
int64_t aCurrentTimeInUsec) = 0;
|
||||
|
||||
virtual void Close() = 0;
|
||||
|
|
Загрузка…
Ссылка в новой задаче