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