diff --git a/dom/quota/OriginOperationBase.cpp b/dom/quota/OriginOperationBase.cpp index 36dc06d6a482..8447755f00f1 100644 --- a/dom/quota/OriginOperationBase.cpp +++ b/dom/quota/OriginOperationBase.cpp @@ -8,6 +8,7 @@ #include "mozilla/Assertions.h" #include "mozilla/MozPromise.h" +#include "mozilla/StaticPrefs_dom.h" #include "mozilla/dom/fs/TargetPtrHolder.h" #include "mozilla/dom/quota/OriginOperationCallbacks.h" #include "mozilla/dom/quota/QuotaManager.h" @@ -98,6 +99,12 @@ void OriginOperationBase::RunImmediately() { *selfHolder->mQuotaManager)), CreateAndRejectBoolPromise); + uint32_t pauseOnIOThreadMs = StaticPrefs:: + dom_quotaManager_originOperations_pauseOnIOThreadMs(); + if (pauseOnIOThreadMs > 0) { + PR_Sleep(PR_MillisecondsToInterval(pauseOnIOThreadMs)); + } + return BoolPromise::CreateAndResolve(true, __func__); }) ->Then( diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 8ba524e15257..4a4a9907b13a 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -3473,6 +3473,12 @@ value: -1 mirror: always +# A pref that is used to slow down origin operations for testing purposes. +- name: dom.quotaManager.originOperations.pauseOnIOThreadMs + type: RelaxedAtomicUint32 + value: 0 + mirror: always + # A pref that is used to enable testing features. - name: dom.quotaManager.testing type: SequentiallyConsistentAtomicBool