mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 20:07:30 +09:00
Issue #2653 - Part 4: Remove isApp from quota manager and its clients
This commit is contained in:
parent
7f086f216c
commit
53cab0f8ce
11 changed files with 97 additions and 236 deletions
|
|
@ -444,7 +444,6 @@ public:
|
||||||
mWriteParams(aWriteParams),
|
mWriteParams(aWriteParams),
|
||||||
mState(eInitial),
|
mState(eInitial),
|
||||||
mResult(JS::AsmJSCache_InternalError),
|
mResult(JS::AsmJSCache_InternalError),
|
||||||
mIsApp(false),
|
|
||||||
mEnforcingQuota(true),
|
mEnforcingQuota(true),
|
||||||
mDeleteReceived(false),
|
mDeleteReceived(false),
|
||||||
mActorDestroyed(false),
|
mActorDestroyed(false),
|
||||||
|
|
@ -677,7 +676,6 @@ private:
|
||||||
State mState;
|
State mState;
|
||||||
JS::AsmJSCacheResult mResult;
|
JS::AsmJSCacheResult mResult;
|
||||||
|
|
||||||
bool mIsApp;
|
|
||||||
bool mEnforcingQuota;
|
bool mEnforcingQuota;
|
||||||
bool mDeleteReceived;
|
bool mDeleteReceived;
|
||||||
bool mActorDestroyed;
|
bool mActorDestroyed;
|
||||||
|
|
@ -698,12 +696,11 @@ ParentRunnable::InitOnMainThread()
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = QuotaManager::GetInfoFromPrincipal(principal, &mSuffix, &mGroup,
|
rv = QuotaManager::GetInfoFromPrincipal(principal, &mSuffix, &mGroup, &mOrigin);
|
||||||
&mOrigin, &mIsApp);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
mEnforcingQuota =
|
mEnforcingQuota =
|
||||||
QuotaManager::IsQuotaEnforced(quota::PERSISTENCE_TYPE_TEMPORARY, mOrigin, mIsApp);
|
QuotaManager::IsQuotaEnforced(quota::PERSISTENCE_TYPE_TEMPORARY);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -722,7 +719,6 @@ ParentRunnable::OpenDirectory()
|
||||||
QuotaManager::Get()->OpenDirectory(quota::PERSISTENCE_TYPE_TEMPORARY,
|
QuotaManager::Get()->OpenDirectory(quota::PERSISTENCE_TYPE_TEMPORARY,
|
||||||
mGroup,
|
mGroup,
|
||||||
mOrigin,
|
mOrigin,
|
||||||
mIsApp,
|
|
||||||
quota::Client::ASMJS,
|
quota::Client::ASMJS,
|
||||||
/* aExclusive */ true,
|
/* aExclusive */ true,
|
||||||
this);
|
this);
|
||||||
|
|
@ -742,7 +738,6 @@ ParentRunnable::ReadMetadata()
|
||||||
mSuffix,
|
mSuffix,
|
||||||
mGroup,
|
mGroup,
|
||||||
mOrigin,
|
mOrigin,
|
||||||
mIsApp,
|
|
||||||
getter_AddRefs(mDirectory));
|
getter_AddRefs(mDirectory));
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
mResult = JS::AsmJSCache_StorageInitFailure;
|
mResult = JS::AsmJSCache_StorageInitFailure;
|
||||||
|
|
|
||||||
|
|
@ -3026,8 +3026,7 @@ nsDOMWindowUtils::GetFileReferences(const nsAString& aDatabaseName, int64_t aId,
|
||||||
|
|
||||||
nsCString origin;
|
nsCString origin;
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
quota::QuotaManager::GetInfoFromWindow(window, nullptr, nullptr, &origin,
|
quota::QuotaManager::GetInfoFromWindow(window, nullptr, nullptr, &origin);
|
||||||
nullptr);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
IDBOpenDBOptions options;
|
IDBOpenDBOptions options;
|
||||||
|
|
|
||||||
5
dom/cache/Context.cpp
vendored
5
dom/cache/Context.cpp
vendored
|
|
@ -259,7 +259,6 @@ Context::QuotaInitRunnable::OpenDirectory()
|
||||||
QuotaManager::Get()->OpenDirectory(PERSISTENCE_TYPE_DEFAULT,
|
QuotaManager::Get()->OpenDirectory(PERSISTENCE_TYPE_DEFAULT,
|
||||||
mQuotaInfo.mGroup,
|
mQuotaInfo.mGroup,
|
||||||
mQuotaInfo.mOrigin,
|
mQuotaInfo.mOrigin,
|
||||||
mQuotaInfo.mIsApp,
|
|
||||||
quota::Client::DOMCACHE,
|
quota::Client::DOMCACHE,
|
||||||
/* aExclusive */ false,
|
/* aExclusive */ false,
|
||||||
this);
|
this);
|
||||||
|
|
@ -376,8 +375,7 @@ Context::QuotaInitRunnable::Run()
|
||||||
nsresult rv = QuotaManager::GetInfoFromPrincipal(principal,
|
nsresult rv = QuotaManager::GetInfoFromPrincipal(principal,
|
||||||
&mQuotaInfo.mSuffix,
|
&mQuotaInfo.mSuffix,
|
||||||
&mQuotaInfo.mGroup,
|
&mQuotaInfo.mGroup,
|
||||||
&mQuotaInfo.mOrigin,
|
&mQuotaInfo.mOrigin);
|
||||||
&mQuotaInfo.mIsApp);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
resolver->Resolve(rv);
|
resolver->Resolve(rv);
|
||||||
break;
|
break;
|
||||||
|
|
@ -436,7 +434,6 @@ Context::QuotaInitRunnable::Run()
|
||||||
mQuotaInfo.mSuffix,
|
mQuotaInfo.mSuffix,
|
||||||
mQuotaInfo.mGroup,
|
mQuotaInfo.mGroup,
|
||||||
mQuotaInfo.mOrigin,
|
mQuotaInfo.mOrigin,
|
||||||
mQuotaInfo.mIsApp,
|
|
||||||
getter_AddRefs(mQuotaInfo.mDir));
|
getter_AddRefs(mQuotaInfo.mDir));
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
resolver->Resolve(rv);
|
resolver->Resolve(rv);
|
||||||
|
|
|
||||||
3
dom/cache/ManagerId.cpp
vendored
3
dom/cache/ManagerId.cpp
vendored
|
|
@ -29,8 +29,7 @@ ManagerId::Create(nsIPrincipal* aPrincipal, ManagerId** aManagerIdOut)
|
||||||
nsresult rv = QuotaManager::GetInfoFromPrincipal(aPrincipal,
|
nsresult rv = QuotaManager::GetInfoFromPrincipal(aPrincipal,
|
||||||
nullptr, // suffix
|
nullptr, // suffix
|
||||||
nullptr, // group
|
nullptr, // group
|
||||||
"aOrigin,
|
"aOrigin);
|
||||||
nullptr); // is app
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||||
|
|
||||||
RefPtr<ManagerId> ref = new ManagerId(aPrincipal, quotaOrigin);
|
RefPtr<ManagerId> ref = new ManagerId(aPrincipal, quotaOrigin);
|
||||||
|
|
|
||||||
2
dom/cache/Types.h
vendored
2
dom/cache/Types.h
vendored
|
|
@ -28,12 +28,10 @@ static const CacheId INVALID_CACHE_ID = -1;
|
||||||
|
|
||||||
struct QuotaInfo
|
struct QuotaInfo
|
||||||
{
|
{
|
||||||
QuotaInfo() : mIsApp(false) { }
|
|
||||||
nsCOMPtr<nsIFile> mDir;
|
nsCOMPtr<nsIFile> mDir;
|
||||||
nsCString mSuffix;
|
nsCString mSuffix;
|
||||||
nsCString mGroup;
|
nsCString mGroup;
|
||||||
nsCString mOrigin;
|
nsCString mOrigin;
|
||||||
bool mIsApp;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace cache
|
} // namespace cache
|
||||||
|
|
|
||||||
|
|
@ -7394,7 +7394,6 @@ protected:
|
||||||
nsCString mDatabaseId;
|
nsCString mDatabaseId;
|
||||||
nsString mDatabaseFilePath;
|
nsString mDatabaseFilePath;
|
||||||
State mState;
|
State mState;
|
||||||
bool mIsApp;
|
|
||||||
bool mEnforcingQuota;
|
bool mEnforcingQuota;
|
||||||
const bool mDeleting;
|
const bool mDeleting;
|
||||||
bool mBlockedDatabaseOpen;
|
bool mBlockedDatabaseOpen;
|
||||||
|
|
@ -16904,7 +16903,6 @@ Cursor::RecvContinue(const CursorRequestParams& aParams)
|
||||||
FileManager::FileManager(PersistenceType aPersistenceType,
|
FileManager::FileManager(PersistenceType aPersistenceType,
|
||||||
const nsACString& aGroup,
|
const nsACString& aGroup,
|
||||||
const nsACString& aOrigin,
|
const nsACString& aOrigin,
|
||||||
bool aIsApp,
|
|
||||||
const nsAString& aDatabaseName,
|
const nsAString& aDatabaseName,
|
||||||
bool aEnforcingQuota)
|
bool aEnforcingQuota)
|
||||||
: mPersistenceType(aPersistenceType)
|
: mPersistenceType(aPersistenceType)
|
||||||
|
|
@ -16912,7 +16910,6 @@ FileManager::FileManager(PersistenceType aPersistenceType,
|
||||||
, mOrigin(aOrigin)
|
, mOrigin(aOrigin)
|
||||||
, mDatabaseName(aDatabaseName)
|
, mDatabaseName(aDatabaseName)
|
||||||
, mLastFileId(0)
|
, mLastFileId(0)
|
||||||
, mIsApp(aIsApp)
|
|
||||||
, mEnforcingQuota(aEnforcingQuota)
|
, mEnforcingQuota(aEnforcingQuota)
|
||||||
, mInvalidated(false)
|
, mInvalidated(false)
|
||||||
{ }
|
{ }
|
||||||
|
|
@ -18293,7 +18290,7 @@ Maintenance::DirectoryWork()
|
||||||
|
|
||||||
// The storage directory is structured like this:
|
// The storage directory is structured like this:
|
||||||
//
|
//
|
||||||
// <profile>/storage/<persistence>/<origin>/idb/*.sqlite
|
// <profile>\storage\<persistence>\<origin>\idb\*.sqlite
|
||||||
//
|
//
|
||||||
// We have to find all database files that match any persistence type and any
|
// We have to find all database files that match any persistence type and any
|
||||||
// origin. We ignore anything out of the ordinary for now.
|
// origin. We ignore anything out of the ordinary for now.
|
||||||
|
|
@ -18489,7 +18486,6 @@ Maintenance::DirectoryWork()
|
||||||
nsCString suffix;
|
nsCString suffix;
|
||||||
nsCString group;
|
nsCString group;
|
||||||
nsCString origin;
|
nsCString origin;
|
||||||
bool isApp;
|
|
||||||
nsTArray<nsString> databasePaths;
|
nsTArray<nsString> databasePaths;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
@ -18555,8 +18551,7 @@ Maintenance::DirectoryWork()
|
||||||
&dummyTimeStamp,
|
&dummyTimeStamp,
|
||||||
suffix,
|
suffix,
|
||||||
group,
|
group,
|
||||||
origin,
|
origin)))) {
|
||||||
&isApp)))) {
|
|
||||||
// Not much we can do here...
|
// Not much we can do here...
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -18582,7 +18577,6 @@ Maintenance::DirectoryWork()
|
||||||
suffix,
|
suffix,
|
||||||
group,
|
group,
|
||||||
origin,
|
origin,
|
||||||
isApp,
|
|
||||||
getter_AddRefs(directory));
|
getter_AddRefs(directory));
|
||||||
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
|
|
@ -19426,7 +19420,6 @@ UpgradeFileIdsFunction::Init(nsIFile* aFMDirectory,
|
||||||
new FileManager(PERSISTENCE_TYPE_INVALID,
|
new FileManager(PERSISTENCE_TYPE_INVALID,
|
||||||
EmptyCString(),
|
EmptyCString(),
|
||||||
EmptyCString(),
|
EmptyCString(),
|
||||||
false,
|
|
||||||
EmptyString(),
|
EmptyString(),
|
||||||
false);
|
false);
|
||||||
|
|
||||||
|
|
@ -20669,7 +20662,6 @@ FactoryOp::FactoryOp(Factory* aFactory,
|
||||||
, mContentParent(Move(aContentParent))
|
, mContentParent(Move(aContentParent))
|
||||||
, mCommonParams(aCommonParams)
|
, mCommonParams(aCommonParams)
|
||||||
, mState(State::Initial)
|
, mState(State::Initial)
|
||||||
, mIsApp(false)
|
|
||||||
, mEnforcingQuota(true)
|
, mEnforcingQuota(true)
|
||||||
, mDeleting(aDeleting)
|
, mDeleting(aDeleting)
|
||||||
, mBlockedDatabaseOpen(false)
|
, mBlockedDatabaseOpen(false)
|
||||||
|
|
@ -21021,13 +21013,11 @@ FactoryOp::CheckPermission(ContentParent* aContentParent,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (State::Initial == mState) {
|
if (State::Initial == mState) {
|
||||||
QuotaManager::GetInfoForChrome(&mSuffix, &mGroup, &mOrigin, &mIsApp);
|
QuotaManager::GetInfoForChrome(&mSuffix, &mGroup, &mOrigin);
|
||||||
|
|
||||||
MOZ_ASSERT(!QuotaManager::IsFirstPromptRequired(persistenceType, mOrigin,
|
MOZ_ASSERT(!QuotaManager::IsFirstPromptRequired(persistenceType, mOrigin));
|
||||||
mIsApp));
|
|
||||||
|
|
||||||
mEnforcingQuota =
|
mEnforcingQuota = QuotaManager::IsQuotaEnforced(persistenceType);
|
||||||
QuotaManager::IsQuotaEnforced(persistenceType, mOrigin, mIsApp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*aPermission = PermissionRequestBase::kPermissionAllowed;
|
*aPermission = PermissionRequestBase::kPermissionAllowed;
|
||||||
|
|
@ -21046,19 +21036,17 @@ FactoryOp::CheckPermission(ContentParent* aContentParent,
|
||||||
nsCString suffix;
|
nsCString suffix;
|
||||||
nsCString group;
|
nsCString group;
|
||||||
nsCString origin;
|
nsCString origin;
|
||||||
bool isApp;
|
|
||||||
rv = QuotaManager::GetInfoFromPrincipal(principal,
|
rv = QuotaManager::GetInfoFromPrincipal(principal,
|
||||||
&suffix,
|
&suffix,
|
||||||
&group,
|
&group,
|
||||||
&origin,
|
&origin);
|
||||||
&isApp);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
PermissionRequestBase::PermissionValue permission;
|
PermissionRequestBase::PermissionValue permission;
|
||||||
|
|
||||||
if (QuotaManager::IsFirstPromptRequired(persistenceType, origin, isApp)) {
|
if (QuotaManager::IsFirstPromptRequired(persistenceType, origin)) {
|
||||||
rv = PermissionRequestBase::GetCurrentPermission(principal, &permission);
|
rv = PermissionRequestBase::GetCurrentPermission(principal, &permission);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
|
|
@ -21072,10 +21060,8 @@ FactoryOp::CheckPermission(ContentParent* aContentParent,
|
||||||
mSuffix = suffix;
|
mSuffix = suffix;
|
||||||
mGroup = group;
|
mGroup = group;
|
||||||
mOrigin = origin;
|
mOrigin = origin;
|
||||||
mIsApp = isApp;
|
|
||||||
|
|
||||||
mEnforcingQuota =
|
mEnforcingQuota = QuotaManager::IsQuotaEnforced(persistenceType);
|
||||||
QuotaManager::IsQuotaEnforced(persistenceType, mOrigin, mIsApp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*aPermission = permission;
|
*aPermission = permission;
|
||||||
|
|
@ -21232,7 +21218,6 @@ FactoryOp::OpenDirectory()
|
||||||
quotaManager->OpenDirectory(persistenceType,
|
quotaManager->OpenDirectory(persistenceType,
|
||||||
mGroup,
|
mGroup,
|
||||||
mOrigin,
|
mOrigin,
|
||||||
mIsApp,
|
|
||||||
Client::IDB,
|
Client::IDB,
|
||||||
/* aExclusive */ false,
|
/* aExclusive */ false,
|
||||||
this);
|
this);
|
||||||
|
|
@ -21497,7 +21482,6 @@ OpenDatabaseOp::DoDatabaseWork()
|
||||||
mSuffix,
|
mSuffix,
|
||||||
mGroup,
|
mGroup,
|
||||||
mOrigin,
|
mOrigin,
|
||||||
mIsApp,
|
|
||||||
getter_AddRefs(dbDirectory));
|
getter_AddRefs(dbDirectory));
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
|
|
@ -21618,7 +21602,6 @@ OpenDatabaseOp::DoDatabaseWork()
|
||||||
fileManager = new FileManager(persistenceType,
|
fileManager = new FileManager(persistenceType,
|
||||||
mGroup,
|
mGroup,
|
||||||
mOrigin,
|
mOrigin,
|
||||||
mIsApp,
|
|
||||||
databaseName,
|
databaseName,
|
||||||
mEnforcingQuota);
|
mEnforcingQuota);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@ class FileManager final
|
||||||
// Protected by IndexedDatabaseManager::FileMutex()
|
// Protected by IndexedDatabaseManager::FileMutex()
|
||||||
nsDataHashtable<nsUint64HashKey, FileInfo*> mFileInfos;
|
nsDataHashtable<nsUint64HashKey, FileInfo*> mFileInfos;
|
||||||
|
|
||||||
const bool mIsApp;
|
|
||||||
const bool mEnforcingQuota;
|
const bool mEnforcingQuota;
|
||||||
bool mInvalidated;
|
bool mInvalidated;
|
||||||
|
|
||||||
|
|
@ -65,7 +64,6 @@ public:
|
||||||
FileManager(PersistenceType aPersistenceType,
|
FileManager(PersistenceType aPersistenceType,
|
||||||
const nsACString& aGroup,
|
const nsACString& aGroup,
|
||||||
const nsACString& aOrigin,
|
const nsACString& aOrigin,
|
||||||
bool aIsApp,
|
|
||||||
const nsAString& aDatabaseName,
|
const nsAString& aDatabaseName,
|
||||||
bool aEnforcingQuota);
|
bool aEnforcingQuota);
|
||||||
|
|
||||||
|
|
@ -87,12 +85,6 @@ public:
|
||||||
return mOrigin;
|
return mOrigin;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
IsApp() const
|
|
||||||
{
|
|
||||||
return mIsApp;
|
|
||||||
}
|
|
||||||
|
|
||||||
const nsAString&
|
const nsAString&
|
||||||
DatabaseName() const
|
DatabaseName() const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1074,7 +1074,7 @@ IDBDatabase::GetQuotaInfo(nsACString& aOrigin,
|
||||||
MOZ_CRASH("Is this needed?!");
|
MOZ_CRASH("Is this needed?!");
|
||||||
|
|
||||||
case PrincipalInfo::TSystemPrincipalInfo:
|
case PrincipalInfo::TSystemPrincipalInfo:
|
||||||
QuotaManager::GetInfoForChrome(nullptr, nullptr, &aOrigin, nullptr);
|
QuotaManager::GetInfoForChrome(nullptr, nullptr, &aOrigin);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
case PrincipalInfo::TContentPrincipalInfo: {
|
case PrincipalInfo::TContentPrincipalInfo: {
|
||||||
|
|
@ -1088,8 +1088,7 @@ IDBDatabase::GetQuotaInfo(nsACString& aOrigin,
|
||||||
rv = QuotaManager::GetInfoFromPrincipal(principal,
|
rv = QuotaManager::GetInfoFromPrincipal(principal,
|
||||||
nullptr,
|
nullptr,
|
||||||
nullptr,
|
nullptr,
|
||||||
&aOrigin,
|
&aOrigin);
|
||||||
nullptr);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1272,7 +1272,6 @@ DeleteFilesRunnable::Open()
|
||||||
quotaManager->OpenDirectory(mFileManager->Type(),
|
quotaManager->OpenDirectory(mFileManager->Type(),
|
||||||
mFileManager->Group(),
|
mFileManager->Group(),
|
||||||
mFileManager->Origin(),
|
mFileManager->Origin(),
|
||||||
mFileManager->IsApp(),
|
|
||||||
Client::IDB,
|
Client::IDB,
|
||||||
/* aExclusive */ false,
|
/* aExclusive */ false,
|
||||||
this);
|
this);
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,6 @@ class DirectoryLockImpl final
|
||||||
const Nullable<PersistenceType> mPersistenceType;
|
const Nullable<PersistenceType> mPersistenceType;
|
||||||
const nsCString mGroup;
|
const nsCString mGroup;
|
||||||
const OriginScope mOriginScope;
|
const OriginScope mOriginScope;
|
||||||
const Nullable<bool> mIsApp;
|
|
||||||
const Nullable<Client::Type> mClientType;
|
const Nullable<Client::Type> mClientType;
|
||||||
RefPtr<OpenDirectoryListener> mOpenListener;
|
RefPtr<OpenDirectoryListener> mOpenListener;
|
||||||
|
|
||||||
|
|
@ -228,7 +227,6 @@ public:
|
||||||
Nullable<PersistenceType> aPersistenceType,
|
Nullable<PersistenceType> aPersistenceType,
|
||||||
const nsACString& aGroup,
|
const nsACString& aGroup,
|
||||||
const OriginScope& aOriginScope,
|
const OriginScope& aOriginScope,
|
||||||
Nullable<bool> aIsApp,
|
|
||||||
Nullable<Client::Type> aClientType,
|
Nullable<Client::Type> aClientType,
|
||||||
bool aExclusive,
|
bool aExclusive,
|
||||||
bool aInternal,
|
bool aInternal,
|
||||||
|
|
@ -260,12 +258,6 @@ public:
|
||||||
return mOriginScope;
|
return mOriginScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Nullable<bool>&
|
|
||||||
GetIsApp() const
|
|
||||||
{
|
|
||||||
return mIsApp;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Nullable<Client::Type>&
|
const Nullable<Client::Type>&
|
||||||
GetClientType() const
|
GetClientType() const
|
||||||
{
|
{
|
||||||
|
|
@ -455,10 +447,12 @@ class OriginInfo final
|
||||||
friend class QuotaObject;
|
friend class QuotaObject;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OriginInfo(GroupInfo* aGroupInfo, const nsACString& aOrigin, bool aIsApp,
|
OriginInfo(GroupInfo* aGroupInfo, const nsACString& aOrigin,
|
||||||
uint64_t aUsage, int64_t aAccessTime)
|
uint64_t aUsage, int64_t aAccessTime)
|
||||||
: mGroupInfo(aGroupInfo), mOrigin(aOrigin), mUsage(aUsage),
|
: mGroupInfo(aGroupInfo)
|
||||||
mAccessTime(aAccessTime), mIsApp(aIsApp)
|
, mOrigin(aOrigin)
|
||||||
|
, mUsage(aUsage)
|
||||||
|
, mAccessTime(aAccessTime)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(OriginInfo);
|
MOZ_COUNT_CTOR(OriginInfo);
|
||||||
}
|
}
|
||||||
|
|
@ -497,7 +491,6 @@ private:
|
||||||
const nsCString mOrigin;
|
const nsCString mOrigin;
|
||||||
uint64_t mUsage;
|
uint64_t mUsage;
|
||||||
int64_t mAccessTime;
|
int64_t mAccessTime;
|
||||||
const bool mIsApp;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class OriginInfoLRUComparator
|
class OriginInfoLRUComparator
|
||||||
|
|
@ -1024,7 +1017,6 @@ protected:
|
||||||
PersistenceType aPersistenceType,
|
PersistenceType aPersistenceType,
|
||||||
const nsACString& aGroup,
|
const nsACString& aGroup,
|
||||||
const nsACString& aOrigin,
|
const nsACString& aOrigin,
|
||||||
bool aIsApp,
|
|
||||||
UsageInfo* aUsageInfo);
|
UsageInfo* aUsageInfo);
|
||||||
|
|
||||||
// Subclasses use this override to set the IPDL response value.
|
// Subclasses use this override to set the IPDL response value.
|
||||||
|
|
@ -1080,7 +1072,6 @@ class GetOriginUsageOp final
|
||||||
const OriginUsageParams mParams;
|
const OriginUsageParams mParams;
|
||||||
nsCString mSuffix;
|
nsCString mSuffix;
|
||||||
nsCString mGroup;
|
nsCString mGroup;
|
||||||
bool mIsApp;
|
|
||||||
bool mGetGroupUsage;
|
bool mGetGroupUsage;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -1391,7 +1382,6 @@ struct StorageDirectoryHelper::OriginProps
|
||||||
nsCString mOrigin;
|
nsCString mOrigin;
|
||||||
|
|
||||||
Type mType;
|
Type mType;
|
||||||
bool mIsApp;
|
|
||||||
bool mNeedsRestore;
|
bool mNeedsRestore;
|
||||||
bool mIgnore;
|
bool mIgnore;
|
||||||
|
|
||||||
|
|
@ -1399,7 +1389,6 @@ public:
|
||||||
explicit OriginProps()
|
explicit OriginProps()
|
||||||
: mTimestamp(0)
|
: mTimestamp(0)
|
||||||
, mType(eContent)
|
, mType(eContent)
|
||||||
, mIsApp(false)
|
|
||||||
, mNeedsRestore(false)
|
, mNeedsRestore(false)
|
||||||
, mIgnore(false)
|
, mIgnore(false)
|
||||||
{ }
|
{ }
|
||||||
|
|
@ -1593,22 +1582,15 @@ SanitizeOriginString(nsCString& aOrigin)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
IsTreatedAsPersistent(PersistenceType aPersistenceType,
|
IsTreatedAsPersistent(PersistenceType aPersistenceType)
|
||||||
bool aIsApp)
|
|
||||||
{
|
{
|
||||||
if (aPersistenceType == PERSISTENCE_TYPE_PERSISTENT ||
|
return aPersistenceType == PERSISTENCE_TYPE_PERSISTENT;
|
||||||
(aPersistenceType == PERSISTENCE_TYPE_DEFAULT && aIsApp)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
IsTreatedAsTemporary(PersistenceType aPersistenceType,
|
IsTreatedAsTemporary(PersistenceType aPersistenceType)
|
||||||
bool aIsApp)
|
|
||||||
{
|
{
|
||||||
return !IsTreatedAsPersistent(aPersistenceType, aIsApp);
|
return !IsTreatedAsPersistent(aPersistenceType);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
@ -1891,9 +1873,11 @@ GetJarPrefix(uint32_t aAppId,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
CreateDirectoryMetadata(nsIFile* aDirectory, int64_t aTimestamp,
|
CreateDirectoryMetadata(nsIFile* aDirectory,
|
||||||
const nsACString& aSuffix, const nsACString& aGroup,
|
int64_t aTimestamp,
|
||||||
const nsACString& aOrigin, bool aIsApp)
|
const nsACString& aSuffix,
|
||||||
|
const nsACString& aGroup,
|
||||||
|
const nsACString& aOrigin)
|
||||||
{
|
{
|
||||||
AssertIsOnIOThread();
|
AssertIsOnIOThread();
|
||||||
|
|
||||||
|
|
@ -1955,7 +1939,8 @@ CreateDirectoryMetadata(nsIFile* aDirectory, int64_t aTimestamp,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = stream->WriteBoolean(aIsApp);
|
// Currently unused (used to be isApp).
|
||||||
|
rv = stream->WriteBoolean(false);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
@ -1966,7 +1951,7 @@ CreateDirectoryMetadata(nsIFile* aDirectory, int64_t aTimestamp,
|
||||||
nsresult
|
nsresult
|
||||||
CreateDirectoryMetadata2(nsIFile* aDirectory, int64_t aTimestamp,
|
CreateDirectoryMetadata2(nsIFile* aDirectory, int64_t aTimestamp,
|
||||||
const nsACString& aSuffix, const nsACString& aGroup,
|
const nsACString& aSuffix, const nsACString& aGroup,
|
||||||
const nsACString& aOrigin, bool aIsApp)
|
const nsACString& aOrigin)
|
||||||
{
|
{
|
||||||
AssertIsOnIOThread();
|
AssertIsOnIOThread();
|
||||||
|
|
||||||
|
|
@ -2019,7 +2004,8 @@ CreateDirectoryMetadata2(nsIFile* aDirectory, int64_t aTimestamp,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = stream->WriteBoolean(aIsApp);
|
// Currently unused (used to be isApp).
|
||||||
|
rv = stream->WriteBoolean(false);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
@ -2141,7 +2127,6 @@ DirectoryLockImpl::DirectoryLockImpl(QuotaManager* aQuotaManager,
|
||||||
Nullable<PersistenceType> aPersistenceType,
|
Nullable<PersistenceType> aPersistenceType,
|
||||||
const nsACString& aGroup,
|
const nsACString& aGroup,
|
||||||
const OriginScope& aOriginScope,
|
const OriginScope& aOriginScope,
|
||||||
Nullable<bool> aIsApp,
|
|
||||||
Nullable<Client::Type> aClientType,
|
Nullable<Client::Type> aClientType,
|
||||||
bool aExclusive,
|
bool aExclusive,
|
||||||
bool aInternal,
|
bool aInternal,
|
||||||
|
|
@ -2150,7 +2135,6 @@ DirectoryLockImpl::DirectoryLockImpl(QuotaManager* aQuotaManager,
|
||||||
, mPersistenceType(aPersistenceType)
|
, mPersistenceType(aPersistenceType)
|
||||||
, mGroup(aGroup)
|
, mGroup(aGroup)
|
||||||
, mOriginScope(aOriginScope)
|
, mOriginScope(aOriginScope)
|
||||||
, mIsApp(aIsApp)
|
|
||||||
, mClientType(aClientType)
|
, mClientType(aClientType)
|
||||||
, mOpenListener(aOpenListener)
|
, mOpenListener(aOpenListener)
|
||||||
, mExclusive(aExclusive)
|
, mExclusive(aExclusive)
|
||||||
|
|
@ -2165,7 +2149,6 @@ DirectoryLockImpl::DirectoryLockImpl(QuotaManager* aQuotaManager,
|
||||||
aPersistenceType.Value() != PERSISTENCE_TYPE_INVALID);
|
aPersistenceType.Value() != PERSISTENCE_TYPE_INVALID);
|
||||||
MOZ_ASSERT_IF(!aInternal, !aGroup.IsEmpty());
|
MOZ_ASSERT_IF(!aInternal, !aGroup.IsEmpty());
|
||||||
MOZ_ASSERT_IF(!aInternal, aOriginScope.IsOrigin());
|
MOZ_ASSERT_IF(!aInternal, aOriginScope.IsOrigin());
|
||||||
MOZ_ASSERT_IF(!aInternal, !aIsApp.IsNull());
|
|
||||||
MOZ_ASSERT_IF(!aInternal, !aClientType.IsNull());
|
MOZ_ASSERT_IF(!aInternal, !aClientType.IsNull());
|
||||||
MOZ_ASSERT_IF(!aInternal, aClientType.Value() != Client::TYPE_MAX);
|
MOZ_ASSERT_IF(!aInternal, aClientType.Value() != Client::TYPE_MAX);
|
||||||
MOZ_ASSERT_IF(!aInternal, aOpenListener);
|
MOZ_ASSERT_IF(!aInternal, aOpenListener);
|
||||||
|
|
@ -2845,7 +2828,6 @@ auto
|
||||||
QuotaManager::CreateDirectoryLock(Nullable<PersistenceType> aPersistenceType,
|
QuotaManager::CreateDirectoryLock(Nullable<PersistenceType> aPersistenceType,
|
||||||
const nsACString& aGroup,
|
const nsACString& aGroup,
|
||||||
const OriginScope& aOriginScope,
|
const OriginScope& aOriginScope,
|
||||||
Nullable<bool> aIsApp,
|
|
||||||
Nullable<Client::Type> aClientType,
|
Nullable<Client::Type> aClientType,
|
||||||
bool aExclusive,
|
bool aExclusive,
|
||||||
bool aInternal,
|
bool aInternal,
|
||||||
|
|
@ -2859,7 +2841,6 @@ QuotaManager::CreateDirectoryLock(Nullable<PersistenceType> aPersistenceType,
|
||||||
aPersistenceType.Value() != PERSISTENCE_TYPE_INVALID);
|
aPersistenceType.Value() != PERSISTENCE_TYPE_INVALID);
|
||||||
MOZ_ASSERT_IF(!aInternal, !aGroup.IsEmpty());
|
MOZ_ASSERT_IF(!aInternal, !aGroup.IsEmpty());
|
||||||
MOZ_ASSERT_IF(!aInternal, aOriginScope.IsOrigin());
|
MOZ_ASSERT_IF(!aInternal, aOriginScope.IsOrigin());
|
||||||
MOZ_ASSERT_IF(!aInternal, !aIsApp.IsNull());
|
|
||||||
MOZ_ASSERT_IF(!aInternal, !aClientType.IsNull());
|
MOZ_ASSERT_IF(!aInternal, !aClientType.IsNull());
|
||||||
MOZ_ASSERT_IF(!aInternal, aClientType.Value() != Client::TYPE_MAX);
|
MOZ_ASSERT_IF(!aInternal, aClientType.Value() != Client::TYPE_MAX);
|
||||||
MOZ_ASSERT_IF(!aInternal, aOpenListener);
|
MOZ_ASSERT_IF(!aInternal, aOpenListener);
|
||||||
|
|
@ -2868,7 +2849,6 @@ QuotaManager::CreateDirectoryLock(Nullable<PersistenceType> aPersistenceType,
|
||||||
aPersistenceType,
|
aPersistenceType,
|
||||||
aGroup,
|
aGroup,
|
||||||
aOriginScope,
|
aOriginScope,
|
||||||
aIsApp,
|
|
||||||
aClientType,
|
aClientType,
|
||||||
aExclusive,
|
aExclusive,
|
||||||
aInternal,
|
aInternal,
|
||||||
|
|
@ -2900,8 +2880,7 @@ QuotaManager::CreateDirectoryLock(Nullable<PersistenceType> aPersistenceType,
|
||||||
auto
|
auto
|
||||||
QuotaManager::CreateDirectoryLockForEviction(PersistenceType aPersistenceType,
|
QuotaManager::CreateDirectoryLockForEviction(PersistenceType aPersistenceType,
|
||||||
const nsACString& aGroup,
|
const nsACString& aGroup,
|
||||||
const nsACString& aOrigin,
|
const nsACString& aOrigin)
|
||||||
bool aIsApp)
|
|
||||||
-> already_AddRefed<DirectoryLockImpl>
|
-> already_AddRefed<DirectoryLockImpl>
|
||||||
{
|
{
|
||||||
AssertIsOnOwningThread();
|
AssertIsOnOwningThread();
|
||||||
|
|
@ -2913,7 +2892,6 @@ QuotaManager::CreateDirectoryLockForEviction(PersistenceType aPersistenceType,
|
||||||
Nullable<PersistenceType>(aPersistenceType),
|
Nullable<PersistenceType>(aPersistenceType),
|
||||||
aGroup,
|
aGroup,
|
||||||
OriginScope::FromOrigin(aOrigin),
|
OriginScope::FromOrigin(aOrigin),
|
||||||
Nullable<bool>(aIsApp),
|
|
||||||
Nullable<Client::Type>(),
|
Nullable<Client::Type>(),
|
||||||
/* aExclusive */ true,
|
/* aExclusive */ true,
|
||||||
/* aInternal */ true,
|
/* aInternal */ true,
|
||||||
|
|
@ -3028,8 +3006,7 @@ QuotaManager::CollectOriginsForEviction(
|
||||||
nsTArray<OriginInfo*>& aInactiveOriginInfos)
|
nsTArray<OriginInfo*>& aInactiveOriginInfos)
|
||||||
{
|
{
|
||||||
for (OriginInfo* originInfo : aOriginInfos) {
|
for (OriginInfo* originInfo : aOriginInfos) {
|
||||||
MOZ_ASSERT(IsTreatedAsTemporary(originInfo->mGroupInfo->mPersistenceType,
|
MOZ_ASSERT(IsTreatedAsTemporary(originInfo->mGroupInfo->mPersistenceType));
|
||||||
originInfo->mIsApp));
|
|
||||||
|
|
||||||
OriginScope originScope = OriginScope::FromOrigin(originInfo->mOrigin);
|
OriginScope originScope = OriginScope::FromOrigin(originInfo->mOrigin);
|
||||||
|
|
||||||
|
|
@ -3132,8 +3109,7 @@ QuotaManager::CollectOriginsForEviction(
|
||||||
RefPtr<DirectoryLockImpl> lock =
|
RefPtr<DirectoryLockImpl> lock =
|
||||||
CreateDirectoryLockForEviction(originInfo->mGroupInfo->mPersistenceType,
|
CreateDirectoryLockForEviction(originInfo->mGroupInfo->mPersistenceType,
|
||||||
originInfo->mGroupInfo->mGroup,
|
originInfo->mGroupInfo->mGroup,
|
||||||
originInfo->mOrigin,
|
originInfo->mOrigin);
|
||||||
originInfo->mIsApp);
|
|
||||||
aLocks.AppendElement(lock.forget());
|
aLocks.AppendElement(lock.forget());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3283,12 +3259,11 @@ void
|
||||||
QuotaManager::InitQuotaForOrigin(PersistenceType aPersistenceType,
|
QuotaManager::InitQuotaForOrigin(PersistenceType aPersistenceType,
|
||||||
const nsACString& aGroup,
|
const nsACString& aGroup,
|
||||||
const nsACString& aOrigin,
|
const nsACString& aOrigin,
|
||||||
bool aIsApp,
|
|
||||||
uint64_t aUsageBytes,
|
uint64_t aUsageBytes,
|
||||||
int64_t aAccessTime)
|
int64_t aAccessTime)
|
||||||
{
|
{
|
||||||
AssertIsOnIOThread();
|
AssertIsOnIOThread();
|
||||||
MOZ_ASSERT(IsTreatedAsTemporary(aPersistenceType, aIsApp));
|
MOZ_ASSERT(IsTreatedAsTemporary(aPersistenceType));
|
||||||
|
|
||||||
MutexAutoLock lock(mQuotaMutex);
|
MutexAutoLock lock(mQuotaMutex);
|
||||||
|
|
||||||
|
|
@ -3306,7 +3281,7 @@ QuotaManager::InitQuotaForOrigin(PersistenceType aPersistenceType,
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<OriginInfo> originInfo =
|
RefPtr<OriginInfo> originInfo =
|
||||||
new OriginInfo(groupInfo, aOrigin, aIsApp, aUsageBytes, aAccessTime);
|
new OriginInfo(groupInfo, aOrigin, aUsageBytes, aAccessTime);
|
||||||
groupInfo->LockedAddOriginInfo(originInfo);
|
groupInfo->LockedAddOriginInfo(originInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3555,13 +3530,11 @@ QuotaManager::GetDirectoryMetadata2(nsIFile* aDirectory,
|
||||||
int64_t* aTimestamp,
|
int64_t* aTimestamp,
|
||||||
nsACString& aSuffix,
|
nsACString& aSuffix,
|
||||||
nsACString& aGroup,
|
nsACString& aGroup,
|
||||||
nsACString& aOrigin,
|
nsACString& aOrigin)
|
||||||
bool* aIsApp)
|
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(!NS_IsMainThread());
|
MOZ_ASSERT(!NS_IsMainThread());
|
||||||
MOZ_ASSERT(aDirectory);
|
MOZ_ASSERT(aDirectory);
|
||||||
MOZ_ASSERT(aTimestamp);
|
MOZ_ASSERT(aTimestamp);
|
||||||
MOZ_ASSERT(aIsApp);
|
|
||||||
MOZ_ASSERT(mStorageInitialized);
|
MOZ_ASSERT(mStorageInitialized);
|
||||||
|
|
||||||
nsCOMPtr<nsIBinaryInputStream> binaryStream;
|
nsCOMPtr<nsIBinaryInputStream> binaryStream;
|
||||||
|
|
@ -3606,8 +3579,9 @@ QuotaManager::GetDirectoryMetadata2(nsIFile* aDirectory,
|
||||||
rv = binaryStream->ReadCString(origin);
|
rv = binaryStream->ReadCString(origin);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
bool isApp;
|
// Currently unused (used to be isApp).
|
||||||
rv = binaryStream->ReadBoolean(&isApp);
|
bool dummy;
|
||||||
|
rv = binaryStream->ReadBoolean(&dummy);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
@ -3616,7 +3590,6 @@ QuotaManager::GetDirectoryMetadata2(nsIFile* aDirectory,
|
||||||
aSuffix = suffix;
|
aSuffix = suffix;
|
||||||
aGroup = group;
|
aGroup = group;
|
||||||
aOrigin = origin;
|
aOrigin = origin;
|
||||||
*aIsApp = isApp;
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3626,15 +3599,13 @@ QuotaManager::GetDirectoryMetadata2WithRestore(nsIFile* aDirectory,
|
||||||
int64_t* aTimestamp,
|
int64_t* aTimestamp,
|
||||||
nsACString& aSuffix,
|
nsACString& aSuffix,
|
||||||
nsACString& aGroup,
|
nsACString& aGroup,
|
||||||
nsACString& aOrigin,
|
nsACString& aOrigin)
|
||||||
bool* aIsApp)
|
|
||||||
{
|
{
|
||||||
nsresult rv = GetDirectoryMetadata2(aDirectory,
|
nsresult rv = GetDirectoryMetadata2(aDirectory,
|
||||||
aTimestamp,
|
aTimestamp,
|
||||||
aSuffix,
|
aSuffix,
|
||||||
aGroup,
|
aGroup,
|
||||||
aOrigin,
|
aOrigin);
|
||||||
aIsApp);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
rv = RestoreDirectoryMetadata2(aDirectory, aPersistent);
|
rv = RestoreDirectoryMetadata2(aDirectory, aPersistent);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
|
|
@ -3645,8 +3616,7 @@ QuotaManager::GetDirectoryMetadata2WithRestore(nsIFile* aDirectory,
|
||||||
aTimestamp,
|
aTimestamp,
|
||||||
aSuffix,
|
aSuffix,
|
||||||
aGroup,
|
aGroup,
|
||||||
aOrigin,
|
aOrigin);
|
||||||
aIsApp);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
@ -3770,24 +3740,17 @@ QuotaManager::InitializeRepository(PersistenceType aPersistenceType)
|
||||||
nsCString suffix;
|
nsCString suffix;
|
||||||
nsCString group;
|
nsCString group;
|
||||||
nsCString origin;
|
nsCString origin;
|
||||||
bool isApp;
|
|
||||||
rv = GetDirectoryMetadata2WithRestore(childDirectory,
|
rv = GetDirectoryMetadata2WithRestore(childDirectory,
|
||||||
/* aPersistent */ false,
|
/* aPersistent */ false,
|
||||||
×tamp,
|
×tamp,
|
||||||
suffix,
|
suffix,
|
||||||
group,
|
group,
|
||||||
origin,
|
origin);
|
||||||
&isApp);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsTreatedAsPersistent(aPersistenceType, isApp)) {
|
rv = InitializeOrigin(aPersistenceType, group, origin, timestamp, childDirectory);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
rv = InitializeOrigin(aPersistenceType, group, origin, isApp, timestamp,
|
|
||||||
childDirectory);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
@ -3834,7 +3797,6 @@ nsresult
|
||||||
QuotaManager::InitializeOrigin(PersistenceType aPersistenceType,
|
QuotaManager::InitializeOrigin(PersistenceType aPersistenceType,
|
||||||
const nsACString& aGroup,
|
const nsACString& aGroup,
|
||||||
const nsACString& aOrigin,
|
const nsACString& aOrigin,
|
||||||
bool aIsApp,
|
|
||||||
int64_t aAccessTime,
|
int64_t aAccessTime,
|
||||||
nsIFile* aDirectory)
|
nsIFile* aDirectory)
|
||||||
{
|
{
|
||||||
|
|
@ -3842,7 +3804,7 @@ QuotaManager::InitializeOrigin(PersistenceType aPersistenceType,
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
bool trackQuota = IsQuotaEnforced(aPersistenceType, aOrigin, aIsApp);
|
bool trackQuota = IsQuotaEnforced(aPersistenceType);
|
||||||
|
|
||||||
// We need to initialize directories of all clients if they exists and also
|
// We need to initialize directories of all clients if they exists and also
|
||||||
// get the total usage to initialize the quota.
|
// get the total usage to initialize the quota.
|
||||||
|
|
@ -3904,7 +3866,7 @@ QuotaManager::InitializeOrigin(PersistenceType aPersistenceType,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trackQuota) {
|
if (trackQuota) {
|
||||||
InitQuotaForOrigin(aPersistenceType, aGroup, aOrigin, aIsApp,
|
InitQuotaForOrigin(aPersistenceType, aGroup, aOrigin,
|
||||||
usageInfo->TotalUsage(), aAccessTime);
|
usageInfo->TotalUsage(), aAccessTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4383,7 +4345,6 @@ void
|
||||||
QuotaManager::OpenDirectory(PersistenceType aPersistenceType,
|
QuotaManager::OpenDirectory(PersistenceType aPersistenceType,
|
||||||
const nsACString& aGroup,
|
const nsACString& aGroup,
|
||||||
const nsACString& aOrigin,
|
const nsACString& aOrigin,
|
||||||
bool aIsApp,
|
|
||||||
Client::Type aClientType,
|
Client::Type aClientType,
|
||||||
bool aExclusive,
|
bool aExclusive,
|
||||||
OpenDirectoryListener* aOpenListener)
|
OpenDirectoryListener* aOpenListener)
|
||||||
|
|
@ -4394,7 +4355,6 @@ QuotaManager::OpenDirectory(PersistenceType aPersistenceType,
|
||||||
CreateDirectoryLock(Nullable<PersistenceType>(aPersistenceType),
|
CreateDirectoryLock(Nullable<PersistenceType>(aPersistenceType),
|
||||||
aGroup,
|
aGroup,
|
||||||
OriginScope::FromOrigin(aOrigin),
|
OriginScope::FromOrigin(aOrigin),
|
||||||
Nullable<bool>(aIsApp),
|
|
||||||
Nullable<Client::Type>(aClientType),
|
Nullable<Client::Type>(aClientType),
|
||||||
aExclusive,
|
aExclusive,
|
||||||
false,
|
false,
|
||||||
|
|
@ -4415,7 +4375,6 @@ QuotaManager::OpenDirectoryInternal(Nullable<PersistenceType> aPersistenceType,
|
||||||
CreateDirectoryLock(aPersistenceType,
|
CreateDirectoryLock(aPersistenceType,
|
||||||
EmptyCString(),
|
EmptyCString(),
|
||||||
aOriginScope,
|
aOriginScope,
|
||||||
Nullable<bool>(),
|
|
||||||
Nullable<Client::Type>(aClientType),
|
Nullable<Client::Type>(aClientType),
|
||||||
aExclusive,
|
aExclusive,
|
||||||
true,
|
true,
|
||||||
|
|
@ -4471,7 +4430,6 @@ QuotaManager::EnsureOriginIsInitialized(PersistenceType aPersistenceType,
|
||||||
const nsACString& aSuffix,
|
const nsACString& aSuffix,
|
||||||
const nsACString& aGroup,
|
const nsACString& aGroup,
|
||||||
const nsACString& aOrigin,
|
const nsACString& aOrigin,
|
||||||
bool aIsApp,
|
|
||||||
nsIFile** aDirectory)
|
nsIFile** aDirectory)
|
||||||
{
|
{
|
||||||
AssertIsOnIOThread();
|
AssertIsOnIOThread();
|
||||||
|
|
@ -4485,7 +4443,7 @@ QuotaManager::EnsureOriginIsInitialized(PersistenceType aPersistenceType,
|
||||||
getter_AddRefs(directory));
|
getter_AddRefs(directory));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
if (IsTreatedAsPersistent(aPersistenceType, aIsApp)) {
|
if (IsTreatedAsPersistent(aPersistenceType)) {
|
||||||
if (mInitializedOrigins.Contains(OriginKey(aPersistenceType, aOrigin))) {
|
if (mInitializedOrigins.Contains(OriginKey(aPersistenceType, aOrigin))) {
|
||||||
directory.forget(aDirectory);
|
directory.forget(aDirectory);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
@ -4538,7 +4496,7 @@ QuotaManager::EnsureOriginIsInitialized(PersistenceType aPersistenceType,
|
||||||
rv = EnsureDirectory(directory, &created);
|
rv = EnsureDirectory(directory, &created);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
if (IsTreatedAsPersistent(aPersistenceType, aIsApp)) {
|
if (IsTreatedAsPersistent(aPersistenceType)) {
|
||||||
if (created) {
|
if (created) {
|
||||||
timestamp = PR_Now();
|
timestamp = PR_Now();
|
||||||
|
|
||||||
|
|
@ -4546,8 +4504,7 @@ QuotaManager::EnsureOriginIsInitialized(PersistenceType aPersistenceType,
|
||||||
timestamp,
|
timestamp,
|
||||||
aSuffix,
|
aSuffix,
|
||||||
aGroup,
|
aGroup,
|
||||||
aOrigin,
|
aOrigin);
|
||||||
aIsApp);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
@ -4556,8 +4513,7 @@ QuotaManager::EnsureOriginIsInitialized(PersistenceType aPersistenceType,
|
||||||
timestamp,
|
timestamp,
|
||||||
aSuffix,
|
aSuffix,
|
||||||
aGroup,
|
aGroup,
|
||||||
aOrigin,
|
aOrigin);
|
||||||
aIsApp);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
} else {
|
} else {
|
||||||
bool persistent = aPersistenceType == PERSISTENCE_TYPE_PERSISTENT;
|
bool persistent = aPersistenceType == PERSISTENCE_TYPE_PERSISTENT;
|
||||||
|
|
@ -4571,8 +4527,7 @@ QuotaManager::EnsureOriginIsInitialized(PersistenceType aPersistenceType,
|
||||||
MOZ_ASSERT(timestamp <= PR_Now());
|
MOZ_ASSERT(timestamp <= PR_Now());
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = InitializeOrigin(aPersistenceType, aGroup, aOrigin, aIsApp, timestamp,
|
rv = InitializeOrigin(aPersistenceType, aGroup, aOrigin, timestamp, directory);
|
||||||
directory);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
mInitializedOrigins.AppendElement(OriginKey(aPersistenceType, aOrigin));
|
mInitializedOrigins.AppendElement(OriginKey(aPersistenceType, aOrigin));
|
||||||
|
|
@ -4583,8 +4538,7 @@ QuotaManager::EnsureOriginIsInitialized(PersistenceType aPersistenceType,
|
||||||
timestamp,
|
timestamp,
|
||||||
aSuffix,
|
aSuffix,
|
||||||
aGroup,
|
aGroup,
|
||||||
aOrigin,
|
aOrigin);
|
||||||
aIsApp);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
@ -4593,12 +4547,10 @@ QuotaManager::EnsureOriginIsInitialized(PersistenceType aPersistenceType,
|
||||||
timestamp,
|
timestamp,
|
||||||
aSuffix,
|
aSuffix,
|
||||||
aGroup,
|
aGroup,
|
||||||
aOrigin,
|
aOrigin);
|
||||||
aIsApp);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = InitializeOrigin(aPersistenceType, aGroup, aOrigin, aIsApp, timestamp,
|
rv = InitializeOrigin(aPersistenceType, aGroup, aOrigin, timestamp, directory);
|
||||||
directory);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4608,12 +4560,11 @@ QuotaManager::EnsureOriginIsInitialized(PersistenceType aPersistenceType,
|
||||||
|
|
||||||
void
|
void
|
||||||
QuotaManager::OriginClearCompleted(PersistenceType aPersistenceType,
|
QuotaManager::OriginClearCompleted(PersistenceType aPersistenceType,
|
||||||
const nsACString& aOrigin,
|
const nsACString& aOrigin)
|
||||||
bool aIsApp)
|
|
||||||
{
|
{
|
||||||
AssertIsOnIOThread();
|
AssertIsOnIOThread();
|
||||||
|
|
||||||
if (IsTreatedAsPersistent(aPersistenceType, aIsApp)) {
|
if (IsTreatedAsPersistent(aPersistenceType)) {
|
||||||
mInitializedOrigins.RemoveElement(OriginKey(aPersistenceType, aOrigin));
|
mInitializedOrigins.RemoveElement(OriginKey(aPersistenceType, aOrigin));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4715,14 +4666,13 @@ nsresult
|
||||||
QuotaManager::GetInfoFromPrincipal(nsIPrincipal* aPrincipal,
|
QuotaManager::GetInfoFromPrincipal(nsIPrincipal* aPrincipal,
|
||||||
nsACString* aSuffix,
|
nsACString* aSuffix,
|
||||||
nsACString* aGroup,
|
nsACString* aGroup,
|
||||||
nsACString* aOrigin,
|
nsACString* aOrigin)
|
||||||
bool* aIsApp)
|
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MOZ_ASSERT(aPrincipal);
|
MOZ_ASSERT(aPrincipal);
|
||||||
|
|
||||||
if (nsContentUtils::IsSystemPrincipal(aPrincipal)) {
|
if (nsContentUtils::IsSystemPrincipal(aPrincipal)) {
|
||||||
GetInfoForChrome(aSuffix, aGroup, aOrigin, aIsApp);
|
GetInfoForChrome(aSuffix, aGroup, aOrigin);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4780,11 +4730,6 @@ QuotaManager::GetInfoFromPrincipal(nsIPrincipal* aPrincipal,
|
||||||
aOrigin->Assign(origin);
|
aOrigin->Assign(origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aIsApp) {
|
|
||||||
*aIsApp = aPrincipal->GetAppStatus() !=
|
|
||||||
nsIPrincipal::APP_STATUS_NOT_INSTALLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4793,8 +4738,7 @@ nsresult
|
||||||
QuotaManager::GetInfoFromWindow(nsPIDOMWindowOuter* aWindow,
|
QuotaManager::GetInfoFromWindow(nsPIDOMWindowOuter* aWindow,
|
||||||
nsACString* aSuffix,
|
nsACString* aSuffix,
|
||||||
nsACString* aGroup,
|
nsACString* aGroup,
|
||||||
nsACString* aOrigin,
|
nsACString* aOrigin)
|
||||||
bool* aIsApp)
|
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MOZ_ASSERT(aWindow);
|
MOZ_ASSERT(aWindow);
|
||||||
|
|
@ -4806,7 +4750,7 @@ QuotaManager::GetInfoFromWindow(nsPIDOMWindowOuter* aWindow,
|
||||||
NS_ENSURE_TRUE(principal, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(principal, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
GetInfoFromPrincipal(principal, aSuffix, aGroup, aOrigin, aIsApp);
|
GetInfoFromPrincipal(principal, aSuffix, aGroup, aOrigin);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
@ -4816,8 +4760,7 @@ QuotaManager::GetInfoFromWindow(nsPIDOMWindowOuter* aWindow,
|
||||||
void
|
void
|
||||||
QuotaManager::GetInfoForChrome(nsACString* aSuffix,
|
QuotaManager::GetInfoForChrome(nsACString* aSuffix,
|
||||||
nsACString* aGroup,
|
nsACString* aGroup,
|
||||||
nsACString* aOrigin,
|
nsACString* aOrigin)
|
||||||
bool* aIsApp)
|
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MOZ_ASSERT(nsContentUtils::LegacyIsCallerChromeOrNativeCode());
|
MOZ_ASSERT(nsContentUtils::LegacyIsCallerChromeOrNativeCode());
|
||||||
|
|
@ -4831,9 +4774,6 @@ QuotaManager::GetInfoForChrome(nsACString* aSuffix,
|
||||||
if (aOrigin) {
|
if (aOrigin) {
|
||||||
ChromeOrigin(*aOrigin);
|
ChromeOrigin(*aOrigin);
|
||||||
}
|
}
|
||||||
if (aIsApp) {
|
|
||||||
*aIsApp = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|
@ -4854,10 +4794,9 @@ QuotaManager::IsOriginInternal(const nsACString& aOrigin)
|
||||||
// static
|
// static
|
||||||
bool
|
bool
|
||||||
QuotaManager::IsFirstPromptRequired(PersistenceType aPersistenceType,
|
QuotaManager::IsFirstPromptRequired(PersistenceType aPersistenceType,
|
||||||
const nsACString& aOrigin,
|
const nsACString& aOrigin)
|
||||||
bool aIsApp)
|
|
||||||
{
|
{
|
||||||
if (IsTreatedAsTemporary(aPersistenceType, aIsApp)) {
|
if (IsTreatedAsTemporary(aPersistenceType)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4866,11 +4805,9 @@ QuotaManager::IsFirstPromptRequired(PersistenceType aPersistenceType,
|
||||||
|
|
||||||
// static
|
// static
|
||||||
bool
|
bool
|
||||||
QuotaManager::IsQuotaEnforced(PersistenceType aPersistenceType,
|
QuotaManager::IsQuotaEnforced(PersistenceType aPersistenceType)
|
||||||
const nsACString& aOrigin,
|
|
||||||
bool aIsApp)
|
|
||||||
{
|
{
|
||||||
return IsTreatedAsTemporary(aPersistenceType, aIsApp);
|
return IsTreatedAsTemporary(aPersistenceType);
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|
@ -5054,21 +4991,19 @@ QuotaManager::CheckTemporaryStorageLimits()
|
||||||
doomedOriginInfo->mGroupInfo->mPersistenceType;
|
doomedOriginInfo->mGroupInfo->mPersistenceType;
|
||||||
nsCString group = doomedOriginInfo->mGroupInfo->mGroup;
|
nsCString group = doomedOriginInfo->mGroupInfo->mGroup;
|
||||||
nsCString origin = doomedOriginInfo->mOrigin;
|
nsCString origin = doomedOriginInfo->mOrigin;
|
||||||
bool isApp = doomedOriginInfo->mIsApp;
|
|
||||||
LockedRemoveQuotaForOrigin(persistenceType, group, origin);
|
LockedRemoveQuotaForOrigin(persistenceType, group, origin);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
doomedOriginInfos[index] = nullptr;
|
doomedOriginInfos[index] = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
doomedOrigins.AppendElement(OriginParams(persistenceType, origin, isApp));
|
doomedOrigins.AppendElement(OriginParams(persistenceType, origin));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const OriginParams& doomedOrigin : doomedOrigins) {
|
for (const OriginParams& doomedOrigin : doomedOrigins) {
|
||||||
OriginClearCompleted(doomedOrigin.mPersistenceType,
|
OriginClearCompleted(doomedOrigin.mPersistenceType,
|
||||||
doomedOrigin.mOrigin,
|
doomedOrigin.mOrigin);
|
||||||
doomedOrigin.mIsApp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5546,8 +5481,7 @@ FinalizeOriginEvictionOp::DoDirectoryWork(QuotaManager* aQuotaManager)
|
||||||
|
|
||||||
for (RefPtr<DirectoryLockImpl>& lock : mLocks) {
|
for (RefPtr<DirectoryLockImpl>& lock : mLocks) {
|
||||||
aQuotaManager->OriginClearCompleted(lock->GetPersistenceType().Value(),
|
aQuotaManager->OriginClearCompleted(lock->GetPersistenceType().Value(),
|
||||||
lock->GetOriginScope().GetOrigin(),
|
lock->GetOriginScope().GetOrigin());
|
||||||
lock->GetIsApp().Value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
@ -5916,7 +5850,6 @@ QuotaUsageRequestBase::GetUsageForOrigin(QuotaManager* aQuotaManager,
|
||||||
PersistenceType aPersistenceType,
|
PersistenceType aPersistenceType,
|
||||||
const nsACString& aGroup,
|
const nsACString& aGroup,
|
||||||
const nsACString& aOrigin,
|
const nsACString& aOrigin,
|
||||||
bool aIsApp,
|
|
||||||
UsageInfo* aUsageInfo)
|
UsageInfo* aUsageInfo)
|
||||||
{
|
{
|
||||||
AssertIsOnIOThread();
|
AssertIsOnIOThread();
|
||||||
|
|
@ -5939,7 +5872,7 @@ QuotaUsageRequestBase::GetUsageForOrigin(QuotaManager* aQuotaManager,
|
||||||
if (exists && !mCanceled) {
|
if (exists && !mCanceled) {
|
||||||
bool initialized;
|
bool initialized;
|
||||||
|
|
||||||
if (IsTreatedAsPersistent(aPersistenceType, aIsApp)) {
|
if (IsTreatedAsPersistent(aPersistenceType)) {
|
||||||
nsCString originKey = OriginKey(aPersistenceType, aOrigin);
|
nsCString originKey = OriginKey(aPersistenceType, aOrigin);
|
||||||
initialized = aQuotaManager->IsOriginInitialized(originKey);
|
initialized = aQuotaManager->IsOriginInitialized(originKey);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -6147,14 +6080,12 @@ GetUsageOp::TraverseRepository(QuotaManager* aQuotaManager,
|
||||||
nsCString suffix;
|
nsCString suffix;
|
||||||
nsCString group;
|
nsCString group;
|
||||||
nsCString origin;
|
nsCString origin;
|
||||||
bool isApp;
|
|
||||||
rv = aQuotaManager->GetDirectoryMetadata2WithRestore(originDir,
|
rv = aQuotaManager->GetDirectoryMetadata2WithRestore(originDir,
|
||||||
persistent,
|
persistent,
|
||||||
×tamp,
|
×tamp,
|
||||||
suffix,
|
suffix,
|
||||||
group,
|
group,
|
||||||
origin,
|
origin);
|
||||||
&isApp);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
@ -6188,7 +6119,6 @@ GetUsageOp::TraverseRepository(QuotaManager* aQuotaManager,
|
||||||
aPersistenceType,
|
aPersistenceType,
|
||||||
group,
|
group,
|
||||||
origin,
|
origin,
|
||||||
isApp,
|
|
||||||
&usageInfo);
|
&usageInfo);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
|
|
@ -6279,8 +6209,7 @@ GetOriginUsageOp::DoInitOnMainThread()
|
||||||
|
|
||||||
// Figure out which origin we're dealing with.
|
// Figure out which origin we're dealing with.
|
||||||
nsCString origin;
|
nsCString origin;
|
||||||
rv = QuotaManager::GetInfoFromPrincipal(principal, &mSuffix, &mGroup,
|
rv = QuotaManager::GetInfoFromPrincipal(principal, &mSuffix, &mGroup, &origin);
|
||||||
&origin, &mIsApp);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
@ -6309,7 +6238,6 @@ GetOriginUsageOp::DoDirectoryWork(QuotaManager* aQuotaManager)
|
||||||
rv = aQuotaManager->EnsureOriginIsInitialized(PERSISTENCE_TYPE_TEMPORARY,
|
rv = aQuotaManager->EnsureOriginIsInitialized(PERSISTENCE_TYPE_TEMPORARY,
|
||||||
mSuffix, mGroup,
|
mSuffix, mGroup,
|
||||||
mOriginScope.GetOrigin(),
|
mOriginScope.GetOrigin(),
|
||||||
mIsApp,
|
|
||||||
getter_AddRefs(directory));
|
getter_AddRefs(directory));
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
|
|
@ -6328,7 +6256,6 @@ GetOriginUsageOp::DoDirectoryWork(QuotaManager* aQuotaManager)
|
||||||
type,
|
type,
|
||||||
mGroup,
|
mGroup,
|
||||||
mOriginScope.GetOrigin(),
|
mOriginScope.GetOrigin(),
|
||||||
mIsApp,
|
|
||||||
&usageInfo);
|
&usageInfo);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
|
|
@ -6542,8 +6469,7 @@ OriginClearOp::DoInitOnMainThread()
|
||||||
|
|
||||||
// Figure out which origin we're dealing with.
|
// Figure out which origin we're dealing with.
|
||||||
nsCString origin;
|
nsCString origin;
|
||||||
rv = QuotaManager::GetInfoFromPrincipal(principal, nullptr, nullptr, &origin,
|
rv = QuotaManager::GetInfoFromPrincipal(principal, nullptr, nullptr, &origin);
|
||||||
nullptr);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
@ -6637,14 +6563,12 @@ OriginClearOp::DeleteFiles(QuotaManager* aQuotaManager,
|
||||||
nsCString suffix;
|
nsCString suffix;
|
||||||
nsCString group;
|
nsCString group;
|
||||||
nsCString origin;
|
nsCString origin;
|
||||||
bool isApp;
|
|
||||||
rv = aQuotaManager->GetDirectoryMetadata2WithRestore(file,
|
rv = aQuotaManager->GetDirectoryMetadata2WithRestore(file,
|
||||||
persistent,
|
persistent,
|
||||||
×tamp,
|
×tamp,
|
||||||
suffix,
|
suffix,
|
||||||
group,
|
group,
|
||||||
origin,
|
origin);
|
||||||
&isApp);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -6668,7 +6592,7 @@ OriginClearOp::DeleteFiles(QuotaManager* aQuotaManager,
|
||||||
aQuotaManager->RemoveQuotaForOrigin(aPersistenceType, group, origin);
|
aQuotaManager->RemoveQuotaForOrigin(aPersistenceType, group, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
aQuotaManager->OriginClearCompleted(aPersistenceType, origin, isApp);
|
aQuotaManager->OriginClearCompleted(aPersistenceType, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -6803,8 +6727,7 @@ StorageDirectoryHelper::RunOnMainThread()
|
||||||
case OriginProps::eChrome: {
|
case OriginProps::eChrome: {
|
||||||
QuotaManager::GetInfoForChrome(&originProps.mSuffix,
|
QuotaManager::GetInfoForChrome(&originProps.mSuffix,
|
||||||
&originProps.mGroup,
|
&originProps.mGroup,
|
||||||
&originProps.mOrigin,
|
&originProps.mOrigin);
|
||||||
&originProps.mIsApp);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6824,8 +6747,7 @@ StorageDirectoryHelper::RunOnMainThread()
|
||||||
rv = QuotaManager::GetInfoFromPrincipal(principal,
|
rv = QuotaManager::GetInfoFromPrincipal(principal,
|
||||||
&originProps.mSuffix,
|
&originProps.mSuffix,
|
||||||
&originProps.mGroup,
|
&originProps.mGroup,
|
||||||
&originProps.mOrigin,
|
&originProps.mOrigin);
|
||||||
&originProps.mIsApp);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
@ -7544,8 +7466,7 @@ CreateOrUpgradeDirectoryMetadataHelper::DoProcessOriginDirectories()
|
||||||
originProps.mTimestamp,
|
originProps.mTimestamp,
|
||||||
originProps.mSuffix,
|
originProps.mSuffix,
|
||||||
originProps.mGroup,
|
originProps.mGroup,
|
||||||
originProps.mOrigin,
|
originProps.mOrigin);
|
||||||
originProps.mIsApp);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
@ -7611,8 +7532,7 @@ CreateOrUpgradeDirectoryMetadataHelper::DoProcessOriginDirectories()
|
||||||
originProps.mTimestamp,
|
originProps.mTimestamp,
|
||||||
originProps.mSuffix,
|
originProps.mSuffix,
|
||||||
originProps.mGroup,
|
originProps.mGroup,
|
||||||
originProps.mOrigin,
|
originProps.mOrigin);
|
||||||
originProps.mIsApp);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
@ -7628,7 +7548,8 @@ CreateOrUpgradeDirectoryMetadataHelper::DoProcessOriginDirectories()
|
||||||
|
|
||||||
MOZ_ASSERT(stream);
|
MOZ_ASSERT(stream);
|
||||||
|
|
||||||
rv = stream->WriteBoolean(originProps.mIsApp);
|
// Currently unused (used to be isApp).
|
||||||
|
rv = stream->WriteBoolean(false);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
@ -7801,8 +7722,7 @@ UpgradeDirectoryMetadataFrom1To2Helper::DoProcessOriginDirectories()
|
||||||
originProps.mTimestamp,
|
originProps.mTimestamp,
|
||||||
originProps.mSuffix,
|
originProps.mSuffix,
|
||||||
originProps.mGroup,
|
originProps.mGroup,
|
||||||
originProps.mOrigin,
|
originProps.mOrigin);
|
||||||
originProps.mIsApp);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
@ -7812,8 +7732,7 @@ UpgradeDirectoryMetadataFrom1To2Helper::DoProcessOriginDirectories()
|
||||||
originProps.mTimestamp,
|
originProps.mTimestamp,
|
||||||
originProps.mSuffix,
|
originProps.mSuffix,
|
||||||
originProps.mGroup,
|
originProps.mGroup,
|
||||||
originProps.mOrigin,
|
originProps.mOrigin);
|
||||||
originProps.mIsApp);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
@ -7883,8 +7802,7 @@ RestoreDirectoryMetadata2Helper::DoProcessOriginDirectories()
|
||||||
originProps.mTimestamp,
|
originProps.mTimestamp,
|
||||||
originProps.mSuffix,
|
originProps.mSuffix,
|
||||||
originProps.mGroup,
|
originProps.mGroup,
|
||||||
originProps.mOrigin,
|
originProps.mOrigin);
|
||||||
originProps.mIsApp);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,16 +81,13 @@ protected:
|
||||||
struct OriginParams
|
struct OriginParams
|
||||||
{
|
{
|
||||||
OriginParams(PersistenceType aPersistenceType,
|
OriginParams(PersistenceType aPersistenceType,
|
||||||
const nsACString& aOrigin,
|
const nsACString& aOrigin)
|
||||||
bool aIsApp)
|
|
||||||
: mOrigin(aOrigin)
|
: mOrigin(aOrigin)
|
||||||
, mPersistenceType(aPersistenceType)
|
, mPersistenceType(aPersistenceType)
|
||||||
, mIsApp(aIsApp)
|
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
nsCString mOrigin;
|
nsCString mOrigin;
|
||||||
PersistenceType mPersistenceType;
|
PersistenceType mPersistenceType;
|
||||||
bool mIsApp;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class QuotaManager final
|
class QuotaManager final
|
||||||
|
|
@ -152,7 +149,6 @@ public:
|
||||||
InitQuotaForOrigin(PersistenceType aPersistenceType,
|
InitQuotaForOrigin(PersistenceType aPersistenceType,
|
||||||
const nsACString& aGroup,
|
const nsACString& aGroup,
|
||||||
const nsACString& aOrigin,
|
const nsACString& aOrigin,
|
||||||
bool aIsApp,
|
|
||||||
uint64_t aUsageBytes,
|
uint64_t aUsageBytes,
|
||||||
int64_t aAccessTime);
|
int64_t aAccessTime);
|
||||||
|
|
||||||
|
|
@ -209,8 +205,7 @@ public:
|
||||||
int64_t* aTimestamp,
|
int64_t* aTimestamp,
|
||||||
nsACString& aSuffix,
|
nsACString& aSuffix,
|
||||||
nsACString& aGroup,
|
nsACString& aGroup,
|
||||||
nsACString& aOrigin,
|
nsACString& aOrigin);
|
||||||
bool* aIsApp);
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
GetDirectoryMetadata2WithRestore(nsIFile* aDirectory,
|
GetDirectoryMetadata2WithRestore(nsIFile* aDirectory,
|
||||||
|
|
@ -218,8 +213,7 @@ public:
|
||||||
int64_t* aTimestamp,
|
int64_t* aTimestamp,
|
||||||
nsACString& aSuffix,
|
nsACString& aSuffix,
|
||||||
nsACString& aGroup,
|
nsACString& aGroup,
|
||||||
nsACString& aOrigin,
|
nsACString& aOrigin);
|
||||||
bool* aIsApp);
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
GetDirectoryMetadata2(nsIFile* aDirectory, int64_t* aTimestamp);
|
GetDirectoryMetadata2(nsIFile* aDirectory, int64_t* aTimestamp);
|
||||||
|
|
@ -248,7 +242,6 @@ public:
|
||||||
OpenDirectory(PersistenceType aPersistenceType,
|
OpenDirectory(PersistenceType aPersistenceType,
|
||||||
const nsACString& aGroup,
|
const nsACString& aGroup,
|
||||||
const nsACString& aOrigin,
|
const nsACString& aOrigin,
|
||||||
bool aIsApp,
|
|
||||||
Client::Type aClientType,
|
Client::Type aClientType,
|
||||||
bool aExclusive,
|
bool aExclusive,
|
||||||
OpenDirectoryListener* aOpenListener);
|
OpenDirectoryListener* aOpenListener);
|
||||||
|
|
@ -274,13 +267,11 @@ public:
|
||||||
const nsACString& aSuffix,
|
const nsACString& aSuffix,
|
||||||
const nsACString& aGroup,
|
const nsACString& aGroup,
|
||||||
const nsACString& aOrigin,
|
const nsACString& aOrigin,
|
||||||
bool aIsApp,
|
|
||||||
nsIFile** aDirectory);
|
nsIFile** aDirectory);
|
||||||
|
|
||||||
void
|
void
|
||||||
OriginClearCompleted(PersistenceType aPersistenceType,
|
OriginClearCompleted(PersistenceType aPersistenceType,
|
||||||
const nsACString& aOrigin,
|
const nsACString& aOrigin);
|
||||||
bool aIsApp);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ResetOrClearCompleted();
|
ResetOrClearCompleted();
|
||||||
|
|
@ -366,34 +357,28 @@ public:
|
||||||
GetInfoFromPrincipal(nsIPrincipal* aPrincipal,
|
GetInfoFromPrincipal(nsIPrincipal* aPrincipal,
|
||||||
nsACString* aSuffix,
|
nsACString* aSuffix,
|
||||||
nsACString* aGroup,
|
nsACString* aGroup,
|
||||||
nsACString* aOrigin,
|
nsACString* aOrigin);
|
||||||
bool* aIsApp);
|
|
||||||
|
|
||||||
static nsresult
|
static nsresult
|
||||||
GetInfoFromWindow(nsPIDOMWindowOuter* aWindow,
|
GetInfoFromWindow(nsPIDOMWindowOuter* aWindow,
|
||||||
nsACString* aSuffix,
|
nsACString* aSuffix,
|
||||||
nsACString* aGroup,
|
nsACString* aGroup,
|
||||||
nsACString* aOrigin,
|
nsACString* aOrigin);
|
||||||
bool* aIsApp);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
GetInfoForChrome(nsACString* aSuffix,
|
GetInfoForChrome(nsACString* aSuffix,
|
||||||
nsACString* aGroup,
|
nsACString* aGroup,
|
||||||
nsACString* aOrigin,
|
nsACString* aOrigin);
|
||||||
bool* aIsApp);
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
IsOriginInternal(const nsACString& aOrigin);
|
IsOriginInternal(const nsACString& aOrigin);
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
IsFirstPromptRequired(PersistenceType aPersistenceType,
|
IsFirstPromptRequired(PersistenceType aPersistenceType,
|
||||||
const nsACString& aOrigin,
|
const nsACString& aOrigin);
|
||||||
bool aIsApp);
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
IsQuotaEnforced(PersistenceType aPersistenceType,
|
IsQuotaEnforced(PersistenceType aPersistenceType);
|
||||||
const nsACString& aOrigin,
|
|
||||||
bool aIsApp);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ChromeOrigin(nsACString& aOrigin);
|
ChromeOrigin(nsACString& aOrigin);
|
||||||
|
|
@ -413,7 +398,6 @@ private:
|
||||||
CreateDirectoryLock(Nullable<PersistenceType> aPersistenceType,
|
CreateDirectoryLock(Nullable<PersistenceType> aPersistenceType,
|
||||||
const nsACString& aGroup,
|
const nsACString& aGroup,
|
||||||
const OriginScope& aOriginScope,
|
const OriginScope& aOriginScope,
|
||||||
Nullable<bool> aIsApp,
|
|
||||||
Nullable<Client::Type> aClientType,
|
Nullable<Client::Type> aClientType,
|
||||||
bool aExclusive,
|
bool aExclusive,
|
||||||
bool aInternal,
|
bool aInternal,
|
||||||
|
|
@ -422,8 +406,7 @@ private:
|
||||||
already_AddRefed<DirectoryLockImpl>
|
already_AddRefed<DirectoryLockImpl>
|
||||||
CreateDirectoryLockForEviction(PersistenceType aPersistenceType,
|
CreateDirectoryLockForEviction(PersistenceType aPersistenceType,
|
||||||
const nsACString& aGroup,
|
const nsACString& aGroup,
|
||||||
const nsACString& aOrigin,
|
const nsACString& aOrigin);
|
||||||
bool aIsApp);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
RegisterDirectoryLock(DirectoryLockImpl* aLock);
|
RegisterDirectoryLock(DirectoryLockImpl* aLock);
|
||||||
|
|
@ -468,7 +451,6 @@ private:
|
||||||
InitializeOrigin(PersistenceType aPersistenceType,
|
InitializeOrigin(PersistenceType aPersistenceType,
|
||||||
const nsACString& aGroup,
|
const nsACString& aGroup,
|
||||||
const nsACString& aOrigin,
|
const nsACString& aOrigin,
|
||||||
bool aIsApp,
|
|
||||||
int64_t aAccessTime,
|
int64_t aAccessTime,
|
||||||
nsIFile* aDirectory);
|
nsIFile* aDirectory);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue