Bug 934640 - Add database version to database file managers; r=dom-storage-reviewers,jari

Differential Revision: https://phabricator.services.mozilla.com/D190052
This commit is contained in:
Jan Varga 2024-03-25 10:54:32 +00:00
Родитель c50517443b
Коммит bb9b3669eb
2 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -11716,6 +11716,7 @@ DatabaseFileManager::DatabaseFileManager(
aIsInPrivateBrowsingMode
? new IndexedDBCipherKeyManager("IndexedDBCipherKeyManager")
: nullptr),
mDatabaseVersion(0),
mEnforcingQuota(aEnforcingQuota),
mIsInPrivateBrowsingMode(aIsInPrivateBrowsingMode) {}
@ -15852,6 +15853,8 @@ void OpenDatabaseOp::SendResults() {
// need to update the version in our metadata.
mMetadata->mCommonMetadata.version() = mRequestedVersion;
mFileManager->UpdateDatabaseVersion(mRequestedVersion);
nsresult rv = EnsureDatabaseActorIsAlive();
if (NS_SUCCEEDED(rv)) {
// We successfully opened a database so use its actor as the success

Просмотреть файл

@ -38,6 +38,8 @@ class DatabaseFileManager final
LazyInitializedOnce<const nsString> mDirectoryPath;
LazyInitializedOnce<const nsString> mJournalDirectoryPath;
uint64_t mDatabaseVersion;
const bool mEnforcingQuota;
const bool mIsInPrivateBrowsingMode;
@ -87,6 +89,12 @@ class DatabaseFileManager final
const nsAString& DatabaseFilePath() const { return mDatabaseFilePath; }
uint64_t DatabaseVersion() const { return mDatabaseVersion; }
void UpdateDatabaseVersion(uint64_t aDatabaseVersion) {
mDatabaseVersion = aDatabaseVersion;
}
IndexedDBCipherKeyManager& MutableCipherKeyManagerRef() const {
MOZ_ASSERT(mIsInPrivateBrowsingMode);
MOZ_ASSERT(mCipherKeyManager);