commit 2939c8cad5f0c48696bcb2b5bf769385e7360639
parent fbcdc966d0c3c5ae670fb45f8b1039effd52d3e0
Author: Jan Varga <Jan.Varga@gmail.com>
Date: Tue, 2 Dec 2025 08:42:30 +0000
Bug 1988590 - QM: Fix pref check placement for updating origin access time; r=dom-storage-reviewers,jari
Move the dom.quotaManager.temporaryStorage.updateOriginAccessTime pref check
to the point where the access time is set to the current time, instead of
skipping the entire SaveOriginAccessTimeOp.
The operation must always run because it now also updates the accessed flag,
introduced as part of the L2 cache work.
Testing: Previously verified manually, this testing only feature is now
exercised in test_temporaryStorageCleanup.js added in a follow-up patch for
this bug.
Differential Revision: https://phabricator.services.mozilla.com/D267046
Diffstat:
3 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/dom/quota/ActorsParent.cpp b/dom/quota/ActorsParent.cpp
@@ -7045,11 +7045,6 @@ RefPtr<BoolPromise> QuotaManager::SaveOriginAccessTime(
AssertIsOnOwningThread();
MOZ_ASSERT(aOriginMetadata.mPersistenceType != PERSISTENCE_TYPE_PERSISTENT);
- if (!StaticPrefs::
- dom_quotaManager_temporaryStorage_updateOriginAccessTime()) {
- return BoolPromise::CreateAndResolve(true, __func__);
- }
-
RefPtr<UniversalDirectoryLock> directoryLock =
CreateSaveOriginAccessTimeLock(*this, aOriginMetadata);
@@ -7074,11 +7069,6 @@ RefPtr<BoolPromise> QuotaManager::SaveOriginAccessTime(
MOZ_ASSERT(aDirectoryLock);
MOZ_ASSERT(aDirectoryLock->Acquired());
- if (!StaticPrefs::
- dom_quotaManager_temporaryStorage_updateOriginAccessTime()) {
- return BoolPromise::CreateAndResolve(true, __func__);
- }
-
auto saveOriginAccessTimeOp =
CreateSaveOriginAccessTimeOp(WrapMovingNotNullUnchecked(this),
aOriginMetadata, std::move(aDirectoryLock));
diff --git a/dom/quota/OriginOperations.cpp b/dom/quota/OriginOperations.cpp
@@ -29,6 +29,7 @@
#include "mozilla/RefPtr.h"
#include "mozilla/Result.h"
#include "mozilla/ResultExtensions.h"
+#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/quota/Client.h"
#include "mozilla/dom/quota/CommonMetadata.h"
@@ -1342,7 +1343,11 @@ nsresult SaveOriginAccessTimeOp::DoDirectoryWork(QuotaManager& aQuotaManager) {
auto originStateMetadata = maybeOriginStateMetadata.extract();
- originStateMetadata.mLastAccessTime = PR_Now();
+ // See the documentation for this pref in StaticPrefList.yaml
+ if (StaticPrefs::dom_quotaManager_temporaryStorage_updateOriginAccessTime()) {
+ originStateMetadata.mLastAccessTime = PR_Now();
+ }
+
originStateMetadata.mAccessed = true;
QM_TRY_INSPECT(const auto& file,
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
@@ -4032,7 +4032,8 @@
# based on the LRU policy. When disabled, the access time is stored only once
# when the corresponding origin directory is created for the first time.
#
-# This setting is currently intended for manual testing purposes only.
+# This pref must remain set to true in production, setting it to false is
+# intended for testing only.
- name: dom.quotaManager.temporaryStorage.updateOriginAccessTime
type: RelaxedAtomicBool
value: true