Bug 1685677 - Reduce scope of variables only used within an if statement. r=jstutte

Differential Revision: https://phabricator.services.mozilla.com/D101181
This commit is contained in:
Simon Giesecke 2021-02-02 10:10:45 +00:00
parent 1f967af681
commit fe6a33b7ec

View File

@ -6437,8 +6437,8 @@ QuotaManager::EnsurePersistentOriginIsInitialized(const QuotaInfo& aQuotaInfo) {
return std::pair(std::move(directory), created);
}();
auto& info = mOriginInitializationInfos.GetOrInsert(aQuotaInfo.mOrigin);
if (!info.mPersistentOriginAttempted) {
if (auto& info = mOriginInitializationInfos.GetOrInsert(aQuotaInfo.mOrigin);
!info.mPersistentOriginAttempted) {
Telemetry::Accumulate(Telemetry::QM_FIRST_INITIALIZATION_ATTEMPT,
kPersistentOriginTelemetryKey,
static_cast<uint32_t>(res.isOk()));
@ -7038,8 +7038,8 @@ void QuotaManager::LockedRemoveQuotaForOrigin(
MOZ_ASSERT(pair);
RefPtr<GroupInfo> groupInfo = pair->LockedGetGroupInfo(aPersistenceType);
if (groupInfo) {
if (RefPtr<GroupInfo> groupInfo =
pair->LockedGetGroupInfo(aPersistenceType)) {
groupInfo->LockedRemoveOriginInfo(aGroupAndOrigin.mOrigin);
if (!groupInfo->LockedHasOriginInfos()) {
@ -7376,8 +7376,8 @@ bool QuotaManager::IsSanitizedOriginValid(const nsACString& aSanitizedOrigin) {
int64_t QuotaManager::GenerateDirectoryLockId() {
const int64_t directorylockId = mNextDirectoryLockId;
CheckedInt64 result = CheckedInt64(mNextDirectoryLockId) + 1;
if (result.isValid()) {
if (CheckedInt64 result = CheckedInt64(mNextDirectoryLockId) + 1;
result.isValid()) {
mNextDirectoryLockId = result.value();
} else {
NS_WARNING("Quota manager has run out of ids for directory locks!");