diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
commit | def92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch) | |
tree | 2ef34b9ad8bb9a9220e05d60352558b15f513894 /dom/quota/ActorsParent.cpp | |
parent | Adding debian version 125.0.3-1. (diff) | |
download | firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/quota/ActorsParent.cpp')
-rw-r--r-- | dom/quota/ActorsParent.cpp | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/dom/quota/ActorsParent.cpp b/dom/quota/ActorsParent.cpp index 451d55a450..dc6b49055f 100644 --- a/dom/quota/ActorsParent.cpp +++ b/dom/quota/ActorsParent.cpp @@ -1555,6 +1555,14 @@ QuotaManager::Observer::Observe(nsISupports* aSubject, const char* aTopic, return rv; } +#ifdef XP_WIN + // Annotate if our profile lives on a network resource. + bool isNetworkPath = PathIsNetworkPathW(gBasePath->get()); + CrashReporter::RecordAnnotationBool( + CrashReporter::Annotation::QuotaManagerStorageIsNetworkResource, + isNetworkPath); +#endif + gStorageName = new nsString(); rv = Preferences::GetString("dom.quotaManager.storageName", *gStorageName); @@ -2380,13 +2388,25 @@ void QuotaManager::Shutdown() { ScopedLogExtraInfo scope{ScopedLogExtraInfo::kTagContextTainted, "dom::quota::QuotaManager::Shutdown"_ns}; + // We always need to ensure that firefox does not shutdown with a private + // repository still on disk. They are ideally cleaned up on PBM session end + // but, in some cases like PBM autostart (i.e. + // browser.privatebrowsing.autostart), private repository could only be + // cleaned up on shutdown. ClearPrivateRepository below runs a async op and is + // better to do it before we run the ShutdownStorageOp since it expects all + // cleanup operations to be done by that point. We don't need to use the + // returned promise here because `ClearPrivateRepository` registers the + // underlying `ClearPrivateRepositoryOp` in `gNormalOriginOps`. + ClearPrivateRepository(); + // This must be called before `flagShutdownStarted`, it would fail otherwise. // `ShutdownStorageOp` needs to acquire an exclusive directory lock over // entire <profile>/storage which will abort any existing operations and wait // for all existing directory locks to be released. So the shutdown operation // will effectively run after all existing operations. - // We don't need to use the returned promise here because `ShutdownStorage` - // registers `ShudownStorageOp` in `gNormalOriginOps`. + // Similar, to ClearPrivateRepository operation above, ShutdownStorageOp also + // registers it's operation in `gNormalOriginOps` so we don't need to assign + // returned promise. ShutdownStorage(); flagShutdownStarted(); @@ -3206,6 +3226,15 @@ Result<nsCOMPtr<nsIFile>, nsresult> QuotaManager::GetOriginDirectory( return directory; } +Result<bool, nsresult> QuotaManager::DoesOriginDirectoryExist( + const OriginMetadata& aOriginMetadata) const { + AssertIsOnIOThread(); + + QM_TRY_INSPECT(const auto& directory, GetOriginDirectory(aOriginMetadata)); + + QM_TRY_RETURN(MOZ_TO_RESULT_INVOKE_MEMBER(directory, Exists)); +} + // static nsresult QuotaManager::CreateDirectoryMetadata( nsIFile& aDirectory, int64_t aTimestamp, @@ -3516,6 +3545,18 @@ Result<Ok, nsresult> QuotaManager::RemoveOriginDirectory(nsIFile& aDirectory) { toBeRemovedStorageDir, NSID_TrimBracketsUTF16(nsID::GenerateUUID())))); } +Result<bool, nsresult> QuotaManager::DoesClientDirectoryExist( + const ClientMetadata& aClientMetadata) const { + AssertIsOnIOThread(); + + QM_TRY_INSPECT(const auto& directory, GetOriginDirectory(aClientMetadata)); + + QM_TRY(MOZ_TO_RESULT( + directory->Append(Client::TypeToString(aClientMetadata.mClientType)))); + + QM_TRY_RETURN(MOZ_TO_RESULT_INVOKE_MEMBER(directory, Exists)); +} + template <typename OriginFunc> nsresult QuotaManager::InitializeRepository(PersistenceType aPersistenceType, OriginFunc&& aOriginFunc) { @@ -7638,11 +7679,10 @@ Result<bool, nsresult> UpgradeStorageFrom1_0To2_0Helper::MaybeRemoveAppsData( if (!URLParams::Parse( Substring(originalSuffix, 1, originalSuffix.Length() - 1), true, - [](const nsAString& aName, const nsAString& aValue) { + [](const nsACString& aName, const nsACString& aValue) { if (aName.EqualsLiteral("appId")) { return false; } - return true; })) { QM_TRY(MOZ_TO_RESULT(RemoveObsoleteOrigin(aOriginProps))); |