Bug 1693741 - Retry removing or renaming of origin directories in StorageOperationBase::MaybeRenameOrigin; r=dom-storage-reviewers,sg

Differential Revision: https://phabricator.services.mozilla.com/D105733
This commit is contained in:
Jan Varga 2021-02-19 19:48:31 +00:00
parent e24a1a0c30
commit c3fd525400
2 changed files with 27 additions and 4 deletions

View File

@ -9679,12 +9679,18 @@ Result<bool, nsresult> StorageOperationBase::MaybeRenameOrigin(
"instead of renaming!",
NS_ConvertUTF16toUTF8(oldLeafName).get(),
NS_ConvertUTF16toUTF8(newLeafName).get());
QM_TRY(aOriginProps.mDirectory->Remove(/* recursive */ true));
} else {
QM_TRY(aOriginProps.mDirectory->RenameTo(nullptr, newLeafName));
}
QM_TRY(CallWithDelayedRetriesIfAccessDenied(
[&exists, &aOriginProps, &newLeafName] {
if (exists) {
QM_TRY_RETURN(aOriginProps.mDirectory->Remove(/* recursive */ true));
}
QM_TRY_RETURN(aOriginProps.mDirectory->RenameTo(nullptr, newLeafName));
},
StaticPrefs::dom_quotaManager_directoryRemovalOrRenaming_maxRetries(),
StaticPrefs::dom_quotaManager_directoryRemovalOrRenaming_delayMs()));
return true;
}

View File

@ -2557,6 +2557,23 @@
mirror: always
#endif
# How many times we should retry directory removal or renaming if access was
# denied?
- name: dom.quotaManager.directoryRemovalOrRenaming.maxRetries
type: RelaxedAtomicUint32
#ifdef XP_WIN
value: 10
#else
value: 0
#endif
mirror: always
# How long we should wait between retries (in milliseconds)?
- name: dom.quotaManager.directoryRemovalOrRenaming.delayMs
type: RelaxedAtomicUint32
value: 200
mirror: always
# Reporting API.
- name: dom.reporting.enabled
type: RelaxedAtomicBool