From 03b44ad93d39a328215ffa71ea9a70fdee1d363b Mon Sep 17 00:00:00 2001 From: Csoregi Natalia Date: Sun, 5 Sep 2021 00:22:49 +0300 Subject: [PATCH] Backed out 3 changesets (bug 1722668) for failures on test_unsetLastAccessTime.js. CLOSED TREE Backed out changeset db05822c64ff (bug 1722668) Backed out changeset c9f100cb3f86 (bug 1722668) Backed out changeset a7179b67eb1a (bug 1722668) --- dom/quota/ActorsParent.cpp | 233 +++--------------- dom/quota/QuotaManager.h | 8 +- dom/quota/test/common/global.js | 2 - dom/quota/test/common/system.js | 2 - .../test/xpcshell/test_unaccessedOrigins.js | 166 ------------- .../test/xpcshell/test_unsetLastAccessTime.js | 65 ----- .../xpcshell/unsetLastAccessTime_profile.zip | Bin 2083 -> 0 bytes dom/quota/test/xpcshell/xpcshell.ini | 3 - modules/libpref/init/StaticPrefList.yaml | 25 -- netwerk/base/nsFileStreams.cpp | 8 - netwerk/base/nsFileStreams.h | 2 - netwerk/build/components.conf | 6 - netwerk/build/nsNetCID.h | 8 - 13 files changed, 32 insertions(+), 496 deletions(-) delete mode 100644 dom/quota/test/xpcshell/test_unaccessedOrigins.js delete mode 100644 dom/quota/test/xpcshell/test_unsetLastAccessTime.js delete mode 100644 dom/quota/test/xpcshell/unsetLastAccessTime_profile.zip diff --git a/dom/quota/ActorsParent.cpp b/dom/quota/ActorsParent.cpp index f4103bf7057f..6b0fdef69b5b 100644 --- a/dom/quota/ActorsParent.cpp +++ b/dom/quota/ActorsParent.cpp @@ -286,7 +286,6 @@ constexpr auto kStorageName = u"storage"_ns; constexpr auto kSQLiteSuffix = u".sqlite"_ns; #define INDEXEDDB_DIRECTORY_NAME u"indexedDB" -#define ARCHIVES_DIRECTORY_NAME u"archives" #define PERSISTENT_DIRECTORY_NAME u"persistent" #define PERMANENT_DIRECTORY_NAME u"permanent" #define TEMPORARY_DIRECTORY_NAME u"temporary" @@ -1713,9 +1712,9 @@ class RecordQuotaInfoLoadTimeHelper final : public Runnable { RecordQuotaInfoLoadTimeHelper() : Runnable("dom::quota::RecordQuotaInfoLoadTimeHelper") {} - TimeStamp Start(); + void Start(); - TimeStamp End(); + void End(); private: ~RecordQuotaInfoLoadTimeHelper() = default; @@ -1861,36 +1860,6 @@ Result MaybeUpdateGroupForOrigin( return updated; } -Result MaybeUpdateLastAccessTimeForOrigin( - FullOriginMetadata& aFullOriginMetadata) { - MOZ_ASSERT(!NS_IsMainThread()); - - if (aFullOriginMetadata.mLastAccessTime == INT64_MIN) { - QuotaManager* quotaManager = QuotaManager::Get(); - MOZ_ASSERT(quotaManager); - - QM_TRY_INSPECT( - const auto& metadataFile, - quotaManager->GetDirectoryForOrigin( - aFullOriginMetadata.mPersistenceType, aFullOriginMetadata.mOrigin)); - - QM_TRY(metadataFile->Append(nsLiteralString(METADATA_V2_FILE_NAME))); - - QM_TRY_UNWRAP(int64_t timestamp, - MOZ_TO_RESULT_INVOKE(metadataFile, GetLastModifiedTime)); - - // Need to convert from milliseconds to microseconds. - MOZ_ASSERT((INT64_MAX / PR_USEC_PER_MSEC) > timestamp); - timestamp *= int64_t(PR_USEC_PER_MSEC); - - aFullOriginMetadata.mLastAccessTime = timestamp; - - return true; - } - - return false; -} - } // namespace BackgroundThreadObject::BackgroundThreadObject() @@ -2419,10 +2388,6 @@ int64_t GetLastModifiedTime(PersistenceType aPersistenceType, nsIFile& aFile) { timestamp = PR_Now(); } - // XXX if there were no suitable files for getting last modified time - // (timestamp is still set to INT64_MIN), we should return the current time - // instead of returning INT64_MIN. - return timestamp; } @@ -2668,16 +2633,6 @@ uint64_t GetTemporaryStorageLimit(uint64_t aAvailableSpaceBytes) { return availableSpaceKB * .50 * 1024; } -bool IsOriginUnaccessed(const FullOriginMetadata& aFullOriginMetadata, - const int64_t aRecentTime) { - if (aFullOriginMetadata.mLastAccessTime > aRecentTime) { - return false; - } - - return (aRecentTime - aFullOriginMetadata.mLastAccessTime) / PR_USEC_PER_SEC > - StaticPrefs::dom_quotaManager_unaccessedForLongTimeThresholdSec(); -} - } // namespace /******************************************************************************* @@ -3651,10 +3606,6 @@ nsresult QuotaManager::Init() { QM_TRY_UNWRAP(do_Init(mStoragePath), MOZ_TO_RESULT_INVOKE_TYPED(nsString, baseDir, GetPath)); - QM_TRY_UNWRAP( - do_Init(mStorageArchivesPath), - GetPathForStorage(*baseDir, nsLiteralString(ARCHIVES_DIRECTORY_NAME))); - QM_TRY_UNWRAP( do_Init(mPermanentStoragePath), GetPathForStorage(*baseDir, nsLiteralString(PERMANENT_DIRECTORY_NAME))); @@ -4107,21 +4058,9 @@ nsresult QuotaManager::LoadQuota() { MOZ_ASSERT(mStorageConnection); MOZ_ASSERT(!mTemporaryStorageInitialized); - // A list of all unaccessed default or temporary origins. - nsTArray unaccessedOrigins; - - auto MaybeCollectUnaccessedOrigin = - [loadQuotaInfoStartTime = PR_Now(), - &unaccessedOrigins](auto& fullOriginMetadata) { - if (IsOriginUnaccessed(fullOriginMetadata, loadQuotaInfoStartTime)) { - unaccessedOrigins.AppendElement(std::move(fullOriginMetadata)); - } - }; - auto recordQuotaInfoLoadTimeHelper = MakeRefPtr(); - - const auto startTime = recordQuotaInfoLoadTimeHelper->Start(); + recordQuotaInfoLoadTimeHelper->Start(); auto LoadQuotaFromCache = [&]() -> nsresult { QM_TRY_INSPECT( @@ -4133,15 +4072,10 @@ nsresult QuotaManager::LoadQuota() { "last_access_time, accessed, persisted " "FROM origin"_ns)); - auto autoRemoveQuota = MakeScopeExit([&] { - RemoveQuota(); - unaccessedOrigins.Clear(); - }); + auto autoRemoveQuota = MakeScopeExit([&] { RemoveQuota(); }); QM_TRY(quota::CollectWhileHasResult( - *stmt, - [this, - &MaybeCollectUnaccessedOrigin](auto& stmt) -> Result { + *stmt, [this](auto& stmt) -> Result { QM_TRY_INSPECT(const int32_t& repositoryId, MOZ_TO_RESULT_INVOKE(stmt, GetInt32, 0)); @@ -4165,6 +4099,19 @@ nsresult QuotaManager::LoadQuota() { fullOriginMetadata.mOrigin, MOZ_TO_RESULT_INVOKE_TYPED(nsCString, stmt, GetUTF8String, 3)); + QM_TRY_INSPECT(const bool& updated, + MaybeUpdateGroupForOrigin(fullOriginMetadata)); + + Unused << updated; + + // We don't need to update the .metadata-v2 file on disk here, + // EnsureTemporaryOriginIsInitialized is responsible for doing that. + // We just need to use correct group before initializing quota for the + // given origin. (Note that calling LoadFullOriginMetadataWithRestore + // below might update the group in the metadata file, but only as a + // side-effect. The actual place we ensure consistency is in + // EnsureTemporaryOriginIsInitialized.) + QM_TRY_INSPECT( const auto& clientUsagesText, MOZ_TO_RESULT_INVOKE_TYPED(nsCString, stmt, GetUTF8String, 4)); @@ -4181,25 +4128,6 @@ nsresult QuotaManager::LoadQuota() { QM_TRY_UNWRAP(fullOriginMetadata.mPersisted, MOZ_TO_RESULT_INVOKE(stmt, GetInt32, 8)); - QM_TRY_INSPECT(const bool& groupUpdated, - MaybeUpdateGroupForOrigin(fullOriginMetadata)); - - Unused << groupUpdated; - - QM_TRY_INSPECT( - const bool& lastAccessTimeUpdated, - MaybeUpdateLastAccessTimeForOrigin(fullOriginMetadata)); - - Unused << lastAccessTimeUpdated; - - // We don't need to update the .metadata-v2 file on disk here, - // EnsureTemporaryOriginIsInitialized is responsible for doing that. - // We just need to use correct group and last access time before - // initializing quota for the given origin. (Note that calling - // LoadFullOriginMetadataWithRestore below might update the group in - // the metadata file, but only as a side-effect. The actual place we - // ensure consistency is in EnsureTemporaryOriginIsInitialized.) - if (accessed) { QM_TRY_INSPECT( const auto& directory, @@ -4251,8 +4179,6 @@ nsresult QuotaManager::LoadQuota() { InitQuotaForOrigin(fullOriginMetadata, clientUsages, usage); } - MaybeCollectUnaccessedOrigin(fullOriginMetadata); - return Ok{}; })); @@ -4315,10 +4241,9 @@ nsresult QuotaManager::LoadQuota() { } QM_TRY(([&]() -> Result { - QM_TRY(([this, type, &MaybeCollectUnaccessedOrigin] { + QM_TRY(([this, type] { const auto innerFunc = [&](const auto&) -> nsresult { - return InitializeRepository(type, - MaybeCollectUnaccessedOrigin); + return InitializeRepository(type); }; return ExecuteInitialization( @@ -4340,17 +4265,10 @@ nsresult QuotaManager::LoadQuota() { #endif } + recordQuotaInfoLoadTimeHelper->End(); + autoRemoveQuota.release(); - const auto endTime = recordQuotaInfoLoadTimeHelper->End(); - - if (StaticPrefs::dom_quotaManager_checkQuotaInfoLoadTime() && - static_cast((endTime - startTime).ToMilliseconds()) >= - StaticPrefs::dom_quotaManager_longQuotaInfoLoadTimeThresholdMs() && - !unaccessedOrigins.IsEmpty()) { - QM_WARNONLY_TRY(ArchiveOrigins(unaccessedOrigins)); - } - return NS_OK; } @@ -4699,16 +4617,10 @@ Result QuotaManager::LoadFullOriginMetadata( QM_TRY(binaryStream->Close()); - QM_TRY_INSPECT(const bool& groupUpdated, + QM_TRY_INSPECT(const bool& updated, MaybeUpdateGroupForOrigin(fullOriginMetadata)); - // A workaround for a bug in GetLastModifiedTime implementation which should - // have returned the current time instead of INT64_MIN when there were no - // suitable files for getting last modified time. - QM_TRY_INSPECT(const bool& lastAccessTimeUpdated, - MaybeUpdateLastAccessTimeForOrigin(fullOriginMetadata)); - - if (groupUpdated || lastAccessTimeUpdated) { + if (updated) { // Only overwriting .metadata-v2 (used to overwrite .metadata too) to reduce // I/O. QM_TRY(CreateDirectoryMetadata2( @@ -4745,10 +4657,7 @@ QuotaManager::LoadFullOriginMetadataWithRestore(nsIFile* aDirectory) { }))); } -template -nsresult QuotaManager::InitializeRepository(PersistenceType aPersistenceType, - OriginFunc&& aOriginFunc) { - AssertIsOnIOThread(); +nsresult QuotaManager::InitializeRepository(PersistenceType aPersistenceType) { MOZ_ASSERT(aPersistenceType == PERSISTENCE_TYPE_TEMPORARY || aPersistenceType == PERSISTENCE_TYPE_DEFAULT); @@ -4788,7 +4697,7 @@ nsresult QuotaManager::InitializeRepository(PersistenceType aPersistenceType, QM_TRY( ([this, &childDirectory, &renameAndInitInfos, - aPersistenceType, &aOriginFunc]() -> Result { + aPersistenceType]() -> Result { QM_TRY_INSPECT( const auto& leafName, MOZ_TO_RESULT_INVOKE_TYPED(nsAutoString, childDirectory, @@ -4860,8 +4769,6 @@ nsresult QuotaManager::InitializeRepository(PersistenceType aPersistenceType, return Ok{}; }))); - std::forward(aOriginFunc)(metadata); - break; } @@ -4892,10 +4799,10 @@ nsresult QuotaManager::InitializeRepository(PersistenceType aPersistenceType, return Ok{}; }())); - for (auto& info : renameAndInitInfos) { + for (const auto& info : renameAndInitInfos) { QM_TRY(([&]() -> Result { - QM_TRY(([&directory, &info, this, aPersistenceType, - &aOriginFunc]() -> Result { + QM_TRY(([&directory, &info, this, + aPersistenceType]() -> Result { const auto originDirName = MakeSanitizedOriginString(info.mFullOriginMetadata.mOrigin); @@ -4914,13 +4821,10 @@ nsresult QuotaManager::InitializeRepository(PersistenceType aPersistenceType, QM_TRY(info.mOriginDirectory->RenameTo(nullptr, originDirName)); - // XXX We don't check corruption here ? QM_TRY(InitializeOrigin( aPersistenceType, info.mFullOriginMetadata, info.mTimestamp, info.mPersisted, targetDirectory)); - std::forward(aOriginFunc)(info.mFullOriginMetadata); - return Ok{}; }()), OK_IN_NIGHTLY_PROPAGATE_IN_OTHERS, statusKeeperFunc); @@ -7095,77 +6999,6 @@ void QuotaManager::FinalizeOriginEviction( } } -Result QuotaManager::ArchiveOrigins( - const nsTArray& aFullOriginMetadatas) { - AssertIsOnIOThread(); - MOZ_ASSERT(!aFullOriginMetadatas.IsEmpty()); - - QM_TRY_INSPECT(const auto& storageArchivesDir, - QM_NewLocalFile(*mStorageArchivesPath)); - - // Create another subdir, so once we decide to remove all temporary archives, - // we can remove only the subdir and the parent directory can still be used - // for something else or similar in future. Otherwise, we would have to - // figure out a new name for it. - QM_TRY(storageArchivesDir->Append(u"0"_ns)); - - PRExplodedTime now; - PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &now); - - const auto dateStr = - nsPrintfCString("%04hd-%02" PRId32 "-%02" PRId32, now.tm_year, - now.tm_month + 1, now.tm_mday); - - QM_TRY_INSPECT( - const auto& storageArchiveDir, - CloneFileAndAppend(*storageArchivesDir, NS_ConvertASCIItoUTF16(dateStr))); - - QM_TRY(storageArchiveDir->CreateUnique(nsIFile::DIRECTORY_TYPE, 0700)); - - QM_TRY_INSPECT(const auto& defaultStorageArchiveDir, - CloneFileAndAppend(*storageArchiveDir, - nsLiteralString(DEFAULT_DIRECTORY_NAME))); - - QM_TRY_INSPECT(const auto& temporaryStorageArchiveDir, - CloneFileAndAppend(*storageArchiveDir, - nsLiteralString(TEMPORARY_DIRECTORY_NAME))); - - for (const auto& fullOriginMetadata : aFullOriginMetadatas) { - MOZ_ASSERT( - IsBestEffortPersistenceType(fullOriginMetadata.mPersistenceType)); - - QM_TRY_INSPECT(const auto& directory, - GetDirectoryForOrigin(fullOriginMetadata.mPersistenceType, - fullOriginMetadata.mOrigin)); - - // The origin could have been removed, for example due to corruption. - QM_TRY_INSPECT( - const auto& moved, - QM_OR_ELSE_WARN_IF( - // Expression. - ToResult(directory->MoveTo(fullOriginMetadata.mPersistenceType == - PERSISTENCE_TYPE_DEFAULT - ? defaultStorageArchiveDir - : temporaryStorageArchiveDir, - u""_ns)) - .map([](Ok) { return true; }), - // Predicate. - ([](const nsresult rv) { - return rv == NS_ERROR_FILE_TARGET_DOES_NOT_EXIST || - rv == NS_ERROR_FILE_NOT_FOUND; - }), - // Fallback. - ErrToOk)); - - if (moved) { - RemoveQuotaForOrigin(fullOriginMetadata.mPersistenceType, - fullOriginMetadata); - } - } - - return Ok{}; -} - auto QuotaManager::GetDirectoryLockTable(PersistenceType aPersistenceType) -> DirectoryLockTable& { switch (aPersistenceType) { @@ -7859,7 +7692,7 @@ StoragePressureRunnable::Run() { return NS_OK; } -TimeStamp RecordQuotaInfoLoadTimeHelper::Start() { +void RecordQuotaInfoLoadTimeHelper::Start() { AssertIsOnIOThread(); // XXX: If a OS sleep/wake occur after mStartTime is initialized but before @@ -7867,17 +7700,13 @@ TimeStamp RecordQuotaInfoLoadTimeHelper::Start() { // key "Normal". We are assumming this is rather rare to happen. mStartTime.init(TimeStamp::Now()); MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(this)); - - return *mStartTime; } -TimeStamp RecordQuotaInfoLoadTimeHelper::End() { +void RecordQuotaInfoLoadTimeHelper::End() { AssertIsOnIOThread(); mEndTime.init(TimeStamp::Now()); MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(this)); - - return *mEndTime; } NS_IMETHODIMP diff --git a/dom/quota/QuotaManager.h b/dom/quota/QuotaManager.h index c324cbf6daad..40ac37d0c8f9 100644 --- a/dom/quota/QuotaManager.h +++ b/dom/quota/QuotaManager.h @@ -505,9 +505,7 @@ class QuotaManager final : public BackgroundThreadObject { Result CreateEmptyLocalStorageArchive( nsIFile& aLsArchiveFile) const; - template - nsresult InitializeRepository(PersistenceType aPersistenceType, - OriginFunc&& aOriginFunc); + nsresult InitializeRepository(PersistenceType aPersistenceType); nsresult InitializeOrigin(PersistenceType aPersistenceType, const OriginMetadata& aOriginMetadata, @@ -533,9 +531,6 @@ class QuotaManager final : public BackgroundThreadObject { void FinalizeOriginEviction(nsTArray>&& aLocks); - Result ArchiveOrigins( - const nsTArray& aFullOriginMetadatas); - void ReleaseIOThreadObjects() { AssertIsOnIOThread(); @@ -643,7 +638,6 @@ class QuotaManager final : public BackgroundThreadObject { const nsString mStorageName; LazyInitializedOnce mIndexedDBPath; LazyInitializedOnce mStoragePath; - LazyInitializedOnce mStorageArchivesPath; LazyInitializedOnce mPermanentStoragePath; LazyInitializedOnce mTemporaryStoragePath; LazyInitializedOnce mDefaultStoragePath; diff --git a/dom/quota/test/common/global.js b/dom/quota/test/common/global.js index bb0f3669bef0..ad73ce1d8bd1 100644 --- a/dom/quota/test/common/global.js +++ b/dom/quota/test/common/global.js @@ -3,8 +3,6 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -const INT64_MIN = -0x8000000000000000n; - class RequestError extends Error { constructor(resultCode, resultName) { super(`Request failed (code: ${resultCode}, name: ${resultName})`); diff --git a/dom/quota/test/common/system.js b/dom/quota/test/common/system.js index 25acbe93843f..36130725c56a 100644 --- a/dom/quota/test/common/system.js +++ b/dom/quota/test/common/system.js @@ -3,8 +3,6 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -const PR_USEC_PER_SEC = 1000000; - const NS_ERROR_STORAGE_BUSY = Cr.NS_ERROR_STORAGE_BUSY; loadScript("dom/quota/test/common/global.js"); diff --git a/dom/quota/test/xpcshell/test_unaccessedOrigins.js b/dom/quota/test/xpcshell/test_unaccessedOrigins.js deleted file mode 100644 index fb068fd78986..000000000000 --- a/dom/quota/test/xpcshell/test_unaccessedOrigins.js +++ /dev/null @@ -1,166 +0,0 @@ -/** - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -const SEC_PER_MONTH = 60 * 60 * 24 * 30; - -async function testSteps() { - function getHostname(index) { - return "www.example" + index + ".com"; - } - - function getOrigin(index) { - return "https://" + getHostname(index); - } - - function getOriginDir(index) { - return getRelativeFile("storage/default/https+++" + getHostname(index)); - } - - function updateOriginLastAccessTime(index, deltaSec) { - let originDir = getOriginDir(index); - - let metadataFile = originDir.clone(); - metadataFile.append(".metadata-v2"); - - let fileStream = Cc["@mozilla.org/network/file-stream;1"].createInstance( - Ci.nsIFileStream - ); - fileStream.init(metadataFile, -1, -1, 0); - - let binaryInputStream = Cc[ - "@mozilla.org/binaryinputstream;1" - ].createInstance(Ci.nsIBinaryInputStream); - binaryInputStream.setInputStream(fileStream); - - let lastAccessTime = binaryInputStream.read64(); - - let seekableStream = fileStream.QueryInterface(Ci.nsISeekableStream); - seekableStream.seek(Ci.nsISeekableStream.NS_SEEK_SET, 0); - - binaryOutputStream = Cc["@mozilla.org/binaryoutputstream;1"].createInstance( - Ci.nsIBinaryOutputStream - ); - binaryOutputStream.setOutputStream(fileStream); - - binaryOutputStream.write64(lastAccessTime + deltaSec * PR_USEC_PER_SEC); - - binaryOutputStream.close(); - - binaryInputStream.close(); - } - - function verifyOriginDir(index, shouldExist) { - let originDir = getOriginDir(index); - let exists = originDir.exists(); - if (shouldExist) { - ok(exists, "Origin directory does exist"); - } else { - ok(!exists, "Origin directory doesn't exist"); - } - } - - info("Setting prefs"); - - Services.prefs.setBoolPref("dom.quotaManager.loadQuotaFromCache", false); - Services.prefs.setBoolPref("dom.quotaManager.checkQuotaInfoLoadTime", true); - Services.prefs.setIntPref( - "dom.quotaManager.longQuotaInfoLoadTimeThresholdMs", - 0 - ); - - info("Initializing"); - - request = init(); - await requestFinished(request); - - info("Initializing temporary storage"); - - request = initTemporaryStorage(); - await requestFinished(request); - - info("Initializing origins"); - - for (let index = 0; index < 30; index++) { - request = initTemporaryOrigin("default", getPrincipal(getOrigin(index))); - await requestFinished(request); - } - - info("Updating last access time of selected origins"); - - for (let index = 0; index < 10; index++) { - updateOriginLastAccessTime(index, -14 * SEC_PER_MONTH); - } - - for (let index = 10; index < 20; index++) { - updateOriginLastAccessTime(index, -7 * SEC_PER_MONTH); - } - - info("Resetting"); - - request = reset(); - await requestFinished(request); - - info("Setting pref"); - - Services.prefs.setIntPref( - "dom.quotaManager.unaccessedForLongTimeThresholdSec", - 13 * SEC_PER_MONTH - ); - - info("Initializing"); - - request = init(); - await requestFinished(request); - - info("Initializing temporary storage"); - - request = initTemporaryStorage(); - await requestFinished(request); - - info("Verifying origin directories"); - - for (let index = 0; index < 10; index++) { - verifyOriginDir(index, false); - } - for (let index = 10; index < 30; index++) { - verifyOriginDir(index, true); - } - - info("Resetting"); - - request = reset(); - await requestFinished(request); - - info("Setting pref"); - - Services.prefs.setIntPref( - "dom.quotaManager.unaccessedForLongTimeThresholdSec", - 6 * SEC_PER_MONTH - ); - - info("Initializing"); - - request = init(); - await requestFinished(request); - - info("Initializing temporary storage"); - - request = initTemporaryStorage(); - await requestFinished(request); - - info("Verifying origin directories"); - - for (let index = 0; index < 20; index++) { - verifyOriginDir(index, false); - } - for (let index = 20; index < 30; index++) { - verifyOriginDir(index, true); - } - - info("Resetting"); - - request = reset(); - await requestFinished(request); -} diff --git a/dom/quota/test/xpcshell/test_unsetLastAccessTime.js b/dom/quota/test/xpcshell/test_unsetLastAccessTime.js deleted file mode 100644 index d2774ae7ec2c..000000000000 --- a/dom/quota/test/xpcshell/test_unsetLastAccessTime.js +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -async function testSteps() { - const metadataFile = getRelativeFile( - "storage/default/https+++foo.example.com/.metadata-v2" - ); - - function getLastAccessTime() { - let fileInputStream = Cc[ - "@mozilla.org/network/file-input-stream;1" - ].createInstance(Ci.nsIFileInputStream); - - fileInputStream.init(metadataFile, -1, -1, 0); - - let binaryInputStream = Cc[ - "@mozilla.org/binaryinputstream;1" - ].createInstance(Ci.nsIBinaryInputStream); - - binaryInputStream.setInputStream(fileInputStream); - - return BigInt.asIntN(64, BigInt(binaryInputStream.read64())); - } - - info("Clearing"); - - let request = clear(); - await requestFinished(request); - - info("Installing package"); - - // The profile contains one initialized origin directory, a script for origin - // initialization and the storage database: - // - storage/default/https+++foo.example.com - // - create_db.js - // - storage.sqlite - // The file create_db.js in the package was run locally, specifically it was - // temporarily added to xpcshell.ini and then executed: - // mach xpcshell-test --interactive dom/quota/test/xpcshell/create_db.js - // Note: to make it become the profile in the test, additional manual steps - // are needed. - // 1. Remove the folder "storage/temporary". - // 2. Remove the file "storage/ls-archive.sqlite". - installPackage("unsetLastAccessTime_profile"); - - info("Verifying last access time"); - - ok(getLastAccessTime() == INT64_MIN, "Correct last access time"); - - info("Initializing"); - - request = init(); - await requestFinished(request); - - info("Initializing temporary storage"); - - request = initTemporaryStorage(); - await requestFinished(request); - - info("Verifying last access time"); - - ok(getLastAccessTime() != INT64_MIN, "Correct last access time"); -} diff --git a/dom/quota/test/xpcshell/unsetLastAccessTime_profile.zip b/dom/quota/test/xpcshell/unsetLastAccessTime_profile.zip deleted file mode 100644 index 8c5f0b52a03d20be8c8e1955dfd8a96ce89cb8b1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2083 zcmWIWW@h1H00G@H$zU)8N^mg9Fcg>M7bT{r>W7AKGBAhPs3n4MX$3a}Bg=P21_l-p zpxOYq3A;*BO%OmbAtf~}u{5UyVp6@eT4Dnb6K#?P7LzhcN(zd#wYAgo^Yv0I5_1c3 zQuUJaa|zl2ax(`5$gO>k#d4K^JO>~)A;AW{+|-i9l*E!m-7+I^$bkF!i=cjWHj4CQWKe(yslxiyxd}RnNS>j7xN~g~LnzZS()$>z+S<{{Ite z#d+rjUfC=&*`S1Iqs;%N7Nj{QtOWaA1p9m`VC z?Rbzj{o9EP3D*~J!UT% zi?hVV=k|iuzSMa}X}kHiZLgjdIwN`i>_5}k;{NC}_-C(C%RBnuUE7E5(g*YZH@yFU ze#42A>i=|)-mP%Db=qkG|E`iJ`%Hg4c2ssw`aocIgoMeyz<`eS7*)a4ro=ayEZ@c zYVsEmdF>1bpRQX!Ql(A#EA6sOQoKF9Cb1mnuQisvWXa2AcxC7LQ;Ut0&Xn4|Wwt%I z^;O{F-YzaH$yaXSkG&MNr%Odgf6|^Y#mxMn#bfC=LVg|9o~;vZYMRUQI9Pw~tIXbz z!m>%co^cP`gT>*0GGj8g?kP|5)STTa|E(sRIWORta~|8CKQSCzJ2Jy2SikxDWupC7 zu2p9*J9ed!$)~8UukUb%d{z83QGf%=iWOJ zxM`?5QtYUC_wRcoY1YxwC(Hmszf7n3a?q_YknL=GT5&|4Y z8lomx1y0rTIdNn9lO;#^zOiz2{6A+pg^Nwa?f%~C_)T^v7}ovaF#D3cWLM$>7Cza? z!!H_`3z|1b$whD4z%f^G{gWk$@6K=CCdhl)_|}EegX*G5YkzaTR$EbbSmMh@t4lW< z&lyd2%U>w9CzVT1LioPnx0M>3%N4ge9TYgi_LKGK)Q4<(ivBW-Rt8$HIdfsty{zRo zbHZ8|e7IUt+wH~kM0{q!g!N7n^=%DjPP=#FdZndqR7%GWla6H*CNXeDGRzQn{(ZLh zOmOqM8+%X7&-tvmdi}wQ1M8j_J{OU3-SVjL&%!PIiczMYq;9WVE}gaUhiJj44f9v5 z4A6PDq$VowV%El(`19u5U;l1D`}fr^fhu8PJzMdg7hj(Atm8;e{pnt$x#RWH-4=(| z9iDsmzHQFF!1DM7_1_nn<~%7bIdM$VETA*q!&f4Ty`RHw&xyZbl5{?fQ11qYXVKgk}U(gS=oRZ7}$W&2$-dBvx0a4gw)O! diff --git a/dom/quota/test/xpcshell/xpcshell.ini b/dom/quota/test/xpcshell/xpcshell.ini index bed568332080..e230753468a9 100644 --- a/dom/quota/test/xpcshell/xpcshell.ini +++ b/dom/quota/test/xpcshell/xpcshell.ini @@ -22,7 +22,6 @@ support-files = removeLocalStorage2_profile.zip tempMetadataCleanup_profile.zip unknownFiles_profile.zip - unsetLastAccessTime_profile.zip [make_unknownFiles.js] skip-if = true # Only used for recreating unknownFiles_profile.zip @@ -49,7 +48,5 @@ skip-if = true # Only used for recreating unknownFiles_profile.zip [test_specialOrigins.js] [test_storagePressure.js] [test_tempMetadataCleanup.js] -[test_unaccessedOrigins.js] [test_unknownFiles.js] -[test_unsetLastAccessTime.js] [test_validOrigins.js] diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index fff323065a29..f4df1ae475a2 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -2805,17 +2805,6 @@ value: "storage" mirror: never -# An upper limit for the "age" of an origin. Any origin which is older than the -# threshold is considered as unaccessed. That doesn't necessarily mean that -# such origins will be immediatelly archived. They will be archived only when -# dom.quotaManager.checkQuotaInfoLoadTime is true and loading of quota info -# takes a long time (dom.quotaManager.longQuotaInfoLoadTimeThresholdMs is used -# to decide what is a long quota info load time). -- name: dom.quotaManager.unaccessedForLongTimeThresholdSec - type: RelaxedAtomicUint32 - value: 33696000 # 13 months - mirror: always - # Should we try to load origin information from the cache? # See bug 1563023 for more details. - name: dom.quotaManager.loadQuotaFromCache @@ -2836,20 +2825,6 @@ value: true mirror: always -# Should we check quota info load time and eventually archive some unaccessed -# origins if loading of quota info takes a long time ? -- name: dom.quotaManager.checkQuotaInfoLoadTime - type: RelaxedAtomicBool - value: true - mirror: always - -# An upper limit for quota info load time, anything which takes longer than the -# threshold is considered as long quota info load time. -- name: dom.quotaManager.longQuotaInfoLoadTimeThresholdMs - type: RelaxedAtomicUint32 - value: 21000 # 21 seconds - mirror: always - # Preference that users can set to override temporary storage smart limit # calculation. - name: dom.quotaManager.temporaryStorage.fixedLimit diff --git a/netwerk/base/nsFileStreams.cpp b/netwerk/base/nsFileStreams.cpp index 1f47a9efe5e9..5bb3ba6acab4 100644 --- a/netwerk/base/nsFileStreams.cpp +++ b/netwerk/base/nsFileStreams.cpp @@ -901,14 +901,6 @@ nsSafeFileOutputStream::Finish() { //////////////////////////////////////////////////////////////////////////////// // nsFileStream -nsresult nsFileStream::Create(nsISupports* aOuter, REFNSIID aIID, - void** aResult) { - NS_ENSURE_NO_AGGREGATION(aOuter); - - RefPtr stream = new nsFileStream(); - return stream->QueryInterface(aIID, aResult); -} - NS_IMPL_ISUPPORTS_INHERITED(nsFileStream, nsFileStreamBase, nsIInputStream, nsIOutputStream, nsIFileStream) diff --git a/netwerk/base/nsFileStreams.h b/netwerk/base/nsFileStreams.h index 4f732a47e7ef..8f3eafc9eeaf 100644 --- a/netwerk/base/nsFileStreams.h +++ b/netwerk/base/nsFileStreams.h @@ -258,8 +258,6 @@ class nsFileStream : public nsFileStreamBase, public nsIOutputStream, public nsIFileStream { public: - static nsresult Create(nsISupports* aOuter, REFNSIID aIID, void** aResult); - NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIFILESTREAM NS_FORWARD_NSIINPUTSTREAM(nsFileStreamBase::) diff --git a/netwerk/build/components.conf b/netwerk/build/components.conf index 38db2e513bd7..69e4f547e8eb 100644 --- a/netwerk/build/components.conf +++ b/netwerk/build/components.conf @@ -142,12 +142,6 @@ Classes = [ 'legacy_constructor': 'nsFileOutputStream::Create', 'headers': ['nsFileStreams.h'], }, - { - 'cid': '{648705e9-757a-4d4b-a5bF-0248e512c309}', - 'contract_ids': ['@mozilla.org/network/file-stream;1'], - 'legacy_constructor': 'nsFileStream::Create', - 'headers': ['nsFileStreams.h'], - }, { 'name': 'HttpActivityDistributor', 'cid': '{15629ada-a41c-4a09-961f-6553cd60b1a2}', diff --git a/netwerk/build/nsNetCID.h b/netwerk/build/nsNetCID.h index 00c93e2daecc..3dce83342516 100644 --- a/netwerk/build/nsNetCID.h +++ b/netwerk/build/nsNetCID.h @@ -342,14 +342,6 @@ } \ } -#define NS_LOCALFILESTREAM_CONTRACTID "@mozilla.org/network/file-stream;1" -#define NS_LOCALFILESTREAM_CID \ - { /* 648705e9-757a-4d4b-a5bF-0248e512c309 */ \ - 0x648705e9, 0x757a, 0x4d4b, { \ - 0xa5, 0xbF, 0x02, 0x48, 0xe5, 0x12, 0xc3, 0x09 \ - } \ - } - #define NS_BUFFEREDINPUTSTREAM_CONTRACTID \ "@mozilla.org/network/buffered-input-stream;1" #define NS_BUFFEREDINPUTSTREAM_CID \