forked from mirrors/gecko-dev
Bug 1855142 - Remove FactoryOp::CheckPermission method; r=dom-storage-reviewers,jari
FactoryOp::CheckPermission now contains only permission related code and it always returns PermissionValue::kPermissionAllowed so it can be safely removed. Differential Revision: https://phabricator.services.mozilla.com/D189754
This commit is contained in:
parent
60b1f620b3
commit
c99f1c4777
1 changed files with 2 additions and 47 deletions
|
|
@ -2993,9 +2993,8 @@ class FactoryOp
|
|||
protected:
|
||||
enum class State {
|
||||
// Just created on the PBackground thread, dispatched to the main thread.
|
||||
// Next step is either SendingResults if permission is denied,
|
||||
// PermissionChallenge if the permission is unknown, or FinishOpen
|
||||
// if permission is granted.
|
||||
// Next step is either SendingResults if initialization failed, or
|
||||
// FinishOpen if the initialization succeeded.
|
||||
Initial,
|
||||
|
||||
// Ensuring quota manager is created and opening directory on the
|
||||
|
|
@ -3160,8 +3159,6 @@ class FactoryOp
|
|||
virtual void SendBlockedNotification() = 0;
|
||||
|
||||
private:
|
||||
mozilla::Result<PermissionValue, nsresult> CheckPermission();
|
||||
|
||||
nsresult FinishOpen();
|
||||
|
||||
// Test whether this FactoryOp needs to wait for the given op.
|
||||
|
|
@ -14638,15 +14635,6 @@ nsresult FactoryOp::Open() {
|
|||
MOZ_ASSERT(false);
|
||||
}
|
||||
|
||||
QM_TRY_INSPECT(const auto& permission, CheckPermission());
|
||||
|
||||
MOZ_ASSERT(permission == PermissionValue::kPermissionAllowed ||
|
||||
permission == PermissionValue::kPermissionDenied);
|
||||
|
||||
if (permission == PermissionValue::kPermissionDenied) {
|
||||
return NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR;
|
||||
}
|
||||
|
||||
{
|
||||
// These services have to be started on the main thread currently.
|
||||
|
||||
|
|
@ -14663,8 +14651,6 @@ nsresult FactoryOp::Open() {
|
|||
}
|
||||
}
|
||||
|
||||
MOZ_ASSERT(permission == PermissionValue::kPermissionAllowed);
|
||||
|
||||
mState = State::FinishOpen;
|
||||
MOZ_ALWAYS_SUCCEEDS(mOwningEventTarget->Dispatch(this, NS_DISPATCH_NORMAL));
|
||||
|
||||
|
|
@ -14789,37 +14775,6 @@ void FactoryOp::FinishSendResults() {
|
|||
mFactory = nullptr;
|
||||
}
|
||||
|
||||
Result<PermissionValue, nsresult> FactoryOp::CheckPermission() {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(mState == State::Initial);
|
||||
|
||||
const PrincipalInfo& principalInfo = mCommonParams.principalInfo();
|
||||
MOZ_ASSERT(principalInfo.type() == PrincipalInfo::TSystemPrincipalInfo ||
|
||||
principalInfo.type() == PrincipalInfo::TContentPrincipalInfo);
|
||||
|
||||
if (principalInfo.type() == PrincipalInfo::TSystemPrincipalInfo) {
|
||||
MOZ_ASSERT(mState == State::Initial);
|
||||
|
||||
return PermissionValue::kPermissionAllowed;
|
||||
}
|
||||
|
||||
QM_TRY_INSPECT(
|
||||
const auto& permission,
|
||||
([persistenceType = mCommonParams.metadata().persistenceType(),
|
||||
origin = QuotaManager::GetOriginFromValidatedPrincipalInfo(
|
||||
principalInfo)]() -> mozilla::Result<PermissionValue, nsresult> {
|
||||
if (persistenceType == PERSISTENCE_TYPE_PERSISTENT) {
|
||||
if (QuotaManager::IsOriginInternal(origin)) {
|
||||
return PermissionValue::kPermissionAllowed;
|
||||
}
|
||||
return Err(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
|
||||
}
|
||||
return PermissionValue::kPermissionAllowed;
|
||||
})());
|
||||
|
||||
return permission;
|
||||
}
|
||||
|
||||
nsresult FactoryOp::SendVersionChangeMessages(
|
||||
DatabaseActorInfo* aDatabaseActorInfo, Maybe<Database&> aOpeningDatabase,
|
||||
uint64_t aOldVersion, const Maybe<uint64_t>& aNewVersion) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue