Bug 1619592 - Remove aResetAll param from nsIQuotaManagerService::ResetStoragesForPrincipal; r=dom-workers-and-storage-reviewers,sg

The aResetAll param has been removed from resetStoragesForPrincipal since
there's no use case for it right now (if there's a use case for it in future, it
should be handled by a separate method like resetOriginsByPrefix).

Differential Revision: https://phabricator.services.mozilla.com/D66951

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jan Varga 2020-03-17 13:01:38 +00:00
Родитель 3cd7583a34
Коммит e5f5d6eb65
4 изменённых файлов: 14 добавлений и 30 удалений

Просмотреть файл

@ -1599,6 +1599,7 @@ class ClearRequestBase : public QuotaRequestBase {
class ClearOriginOp final : public ClearRequestBase {
const ClearResetOriginParams mParams;
const bool mMatchAll;
public:
explicit ClearOriginOp(const RequestParams& aParams);
@ -9864,7 +9865,8 @@ nsresult ClearRequestBase::DoDirectoryWork(QuotaManager* aQuotaManager) {
ClearOriginOp::ClearOriginOp(const RequestParams& aParams)
: ClearRequestBase(/* aExclusive */ true),
mParams(aParams.get_ClearOriginParams().commonParams()) {
mParams(aParams.get_ClearOriginParams().commonParams()),
mMatchAll(aParams.get_ClearOriginParams().matchAll()) {
MOZ_ASSERT(aParams.type() == RequestParams::TClearOriginParams);
}
@ -9883,7 +9885,7 @@ void ClearOriginOp::Init(Quota* aQuota) {
QuotaManager::GetInfoFromValidatedPrincipalInfo(mParams.principalInfo(),
nullptr, nullptr, &origin);
if (mParams.matchAll()) {
if (mMatchAll) {
mOriginScope.SetFromPrefix(origin);
} else {
mOriginScope.SetFromOrigin(origin);
@ -9941,11 +9943,7 @@ ResetOriginOp::ResetOriginOp(const RequestParams& aParams)
mPersistenceType.SetValue(params.persistenceType());
}
if (params.matchAll()) {
mOriginScope.SetFromPrefix(origin);
} else {
mOriginScope.SetFromOrigin(origin);
}
mOriginScope.SetFromOrigin(origin);
if (params.clientTypeIsExplicit()) {
mClientType.SetValue(params.clientType());

Просмотреть файл

@ -74,12 +74,12 @@ struct ClearResetOriginParams
bool persistenceTypeIsExplicit;
Type clientType;
bool clientTypeIsExplicit;
bool matchAll;
};
struct ClearOriginParams
{
ClearResetOriginParams commonParams;
bool matchAll;
};
struct ResetOriginParams

Просмотреть файл

@ -67,7 +67,7 @@ nsresult CheckedPrincipalToPrincipalInfo(nsIPrincipal* aPrincipal,
nsresult GetClearResetOriginParams(nsIPrincipal* aPrincipal,
const nsACString& aPersistenceType,
const nsAString& aClientType, bool aMatchAll,
const nsAString& aClientType,
ClearResetOriginParams& aParams) {
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aPrincipal);
@ -104,8 +104,6 @@ nsresult GetClearResetOriginParams(nsIPrincipal* aPrincipal,
aParams.clientTypeIsExplicit() = true;
}
aParams.matchAll() = aMatchAll;
return NS_OK;
}
@ -658,13 +656,14 @@ QuotaManagerService::ClearStoragesForPrincipal(
ClearResetOriginParams commonParams;
nsresult rv = GetClearResetOriginParams(aPrincipal, aPersistenceType,
aClientType, aClearAll, commonParams);
aClientType, commonParams);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
RequestParams params;
params = ClearOriginParams(commonParams);
ClearOriginParams params;
params.commonParams() = std::move(commonParams);
params.matchAll() = aClearAll;
RequestInfo info(request, params);
@ -703,7 +702,7 @@ QuotaManagerService::Reset(nsIQuotaRequest** _retval) {
NS_IMETHODIMP
QuotaManagerService::ResetStoragesForPrincipal(
nsIPrincipal* aPrincipal, const nsACString& aPersistenceType,
const nsAString& aClientType, bool aResetAll, nsIQuotaRequest** _retval) {
const nsAString& aClientType, nsIQuotaRequest** _retval) {
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aPrincipal);
@ -711,21 +710,12 @@ QuotaManagerService::ResetStoragesForPrincipal(
return NS_ERROR_UNEXPECTED;
}
nsCString suffix;
aPrincipal->OriginAttributesRef().CreateSuffix(suffix);
if (NS_WARN_IF(aResetAll && !suffix.IsEmpty())) {
// The originAttributes should be default originAttributes when the
// aClearAll flag is set.
return NS_ERROR_INVALID_ARG;
}
RefPtr<Request> request = new Request(aPrincipal);
ClearResetOriginParams commonParams;
nsresult rv = GetClearResetOriginParams(aPrincipal, aPersistenceType,
aClientType, aResetAll, commonParams);
aClientType, commonParams);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}

Просмотреть файл

@ -209,15 +209,11 @@ interface nsIQuotaManagerService : nsISupports
* from Client.h, then only that client's storage will be cleared.
* If you want to clear multiple client types (but not all), then you
* must call this method multiple times.
* @param aResetAll
* An optional boolean to indicate resetting all storages under the
* given origin.
*/
[must_use] nsIQuotaRequest
resetStoragesForPrincipal(in nsIPrincipal aPrincipal,
[optional] in ACString aPersistenceType,
[optional] in AString aClientType,
[optional] in boolean aResetAll);
[optional] in AString aClientType);
/**
* Check if given origin is persisted.