Commit Graph

597 Commits

Author SHA1 Message Date
Jan Varga
a086d161de Bug 1929603 - Avoid resolving responses in CreateFileSystemManagerParent if the background actor is already dead; r=dom-storage-reviewers,jari
IPC code already handles this internally, but it causes warnings.

Differential Revision: https://phabricator.services.mozilla.com/D225027
2024-11-14 16:52:18 +00:00
Jan Varga
95a9b7daa0 Bug 1929603 - Capture a handle to FileSystemDataManager for all async steps in CreateFileSystemManagerParent which need to access the manager; r=dom-storage-reviewers,jari
Bug 1922525 fixed the main issue related to shutdown requested during
CreateFileSystemManagerParent, so we don't crash anymore. However, correctness
and extra safety (that the manager doesn't start closing during
CreateFileSystemManagerParent), it would be better to capture a handle for all
async steps which need to access the manager.

Differential Revision: https://phabricator.services.mozilla.com/D225019
2024-11-12 16:18:45 +00:00
Nika Layzell
84e123fcb1 Bug 1927476 - Part 1: Switch ResolveCallback/RejectCallback to be MoveOnlyFunction, r=ipc-reviewers,mccr8
This requires a small change to the filesystem code, as the
FileSystemManager::BeginRequest signature explicitly uses the type
outside of IPC code.

We never need to copy the request object, so using std::function applies
unnecessary restrictions.

Differential Revision: https://phabricator.services.mozilla.com/D228098
2024-11-06 18:36:32 +00:00
Jan Varga
c925cf6a17 Bug 1922525 - Handle the case when FileSystemManagerParent gets destroyed as an actor before CreateFileSystemManagerParent is able to register it in FileSystemDataManager; r=dom-storage-reviewers,jesup
Differential Revision: https://phabricator.services.mozilla.com/D224924
2024-11-05 06:27:59 +00:00
serge-sans-paille
8a0a0f7524 Bug 1920718 - Annotate all global variable with runtime initialization attributes r=glandium,application-update-reviewers,media-playback-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,gfx-reviewers,aosmond,lina,nalexander,aabh,geckoview-reviewers,win-reviewers,gstoll,m_kato
MOZ_RUNINIT => initialized at runtime
MOZ_CONSTINIT => initialized at compile time
MOZ_GLOBINIT => initialized either at runtime or compile time, depending on template parameter, macro parameter etc
This annotation is only understood by our clang-tidy plugin. It has no
effect on regular compilation.

Differential Revision: https://phabricator.services.mozilla.com/D223341
2024-10-30 11:05:24 +00:00
Jan Varga
117cb49ba4 Bug 1908663 - Move TargetPtrHolder.h to dom/quota; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D225919
2024-10-29 00:51:19 +00:00
Mike Hommey
aada68ea09 Bug 1924664 - Fix Cargo.toml-related warnings from first-party crates. r=firefox-build-system-reviewers,necko-reviewers,profiler-reviewers,aabh,ahochheiden
The warnings are:

  no edition set: defaulting to the 2015 edition while the latest is 2021
  unused manifest key: lib.plugin

Differential Revision: https://phabricator.services.mozilla.com/D226855
2024-10-28 20:56:36 +00:00
Jan Varga
e79a4c2ad5 Bug 1904562 - Change DirectoryLockImpl to be topmost class; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D214857
2024-10-21 09:31:27 +00:00
Jan Varga
fdb0c7eaa3 Bug 1904562 - Convert BucketFS to use concrete directory lock type; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D214851
2024-10-21 09:31:24 +00:00
Jan Varga
f7feaf03c6 Bug 1904562 - Move ClientDirectoryLock to separate files and make it inherit from DirectoryLockImpl; r=dom-storage-reviewers,aiunusov
Differential Revision: https://phabricator.services.mozilla.com/D214849
2024-10-21 09:31:23 +00:00
Jan Varga
ca3631ab80 Bug 1867997 - Add support for continuous background initialization of all temporary origins collected during temporary storage initialization; r=dom-storage-reviewers,jari
This is finally the patch which fundamentally changes the way how temporary
origins are initialized. Currently, when temporary storage is accessed for the
first time, all temporary origins need to be synchronously initialized. This
causes two major problems. First, large temporary storage can block first page
load for long time. Second, one broken origin breaks entire temporary storage.
These two problems can be mitigated in a big way by making the initialization
asynchronous. A lot of stuff had to be refactored, new infrastructure had to be
added and the support for conditional lazy initialization of origins had to be
implemented. This patch adds support for continuous background initialization
of all temporary origins collected during temporary storage initialization. So
if a page needs to access temporary storage, only origins for given group are
initialized. Origins for other groups are initialized in the background.

The background origin initialization is still considered to be experimental,
not recommended for normal use (disabled by default).

Differential Revision: https://phabricator.services.mozilla.com/D199082
2024-10-20 10:50:40 +00:00
Jan Varga
c08cca4d20 Bug 1867997 - Simplify signature of QuotaManager::OnOriginClearCompleted; r=dom-storage-reviewers,jari
OnOriginClearCompleted currently takes two separate arguments which can be
expressed as just one argument.

Differential Revision: https://phabricator.services.mozilla.com/D198494
2024-10-18 13:14:03 +00:00
Jan Varga
a8506400af Bug 1867997 - Move nsIPrincipal/PrincipalInfo helpers to separate files; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D223992
2024-10-18 01:32:36 +00:00
Jan Varga
9a7972be63 Bug 1867997 - Change QuotaManager::GetInfoFromValidatedPrincipalInfo to be a stacic method; r=dom-storage-reviewers,jari
This is a preparation for moving all nsIPrincipal and PrincipalInfo helpers to separate source files.

Differential Revision: https://phabricator.services.mozilla.com/D223950
2024-10-18 01:32:35 +00:00
Jan Varga
491af5e199 Bug 1866402 - Replace most of QuotaManager::EnsurePersistentOriginIsInitializedInternal and QuotaManager::EnsureTemporaryOriginIsInitializedInternal calls; r=dom-storage-reviewers,jari
QuotaManager::OpenClientDirectory already makes sure that corresponding origin
is initialized so all places where a client directory lock is obtained in such
way can start using QuotaManager::GetOriginDirectory instead of
QuotaManager::EnsurePersistentOriginIsInitializedInternal and
QuotaManager::GetOrCreateTemporaryOriginDirectory instead of
QuotaManager::EnsureTemporaryOriginIsInitializedInternal.

Differential Revision: https://phabricator.services.mozilla.com/D195589
2024-10-13 23:05:25 +00:00
Jan Varga
196dc764ef Bug 1866402 - Make it possible to initialize temporary origins without ensuring origin directories; r=dom-storage-reviewers,jari
LSNG already uses some QuotaManager APIs to achieve that origin directories are
not created if they don't exist during datastore preparation, but the feature
is not easy to use and it's also not generalized enough for use in other quota
clients. Besides that, the way how it's currently done in LSNG complicates
removal of QuotaManager::EnsureTemporaryOriginIsInitializedInternal calls from
LSNG. This patch is about generalizing of the feature, making it available to
all quota clients.

Differential Revision: https://phabricator.services.mozilla.com/D195551
2024-10-12 20:58:36 +00:00
Sebastian Hengst
d0c13bb2a9 Backed out 7 changesets (bug 1866402) for causing crashes (bug 1762908). a=backout
Backed out changeset 6180f2e753bd (bug 1866402)
Backed out changeset f25dfc157ef7 (bug 1866402)
Backed out changeset d63dac1ee4d4 (bug 1866402)
Backed out changeset 2ab08c49f2b1 (bug 1866402)
Backed out changeset 48781c71d287 (bug 1866402)
Backed out changeset a649d075c9b3 (bug 1866402)
Backed out changeset cc03e4975743 (bug 1866402)
2024-10-11 12:47:35 +02:00
Jan Varga
2a11d937ee Bug 1866402 - Make it possible to initialize temporary origins without ensuring origin directories; r=dom-storage-reviewers,jari
LSNG already uses some QuotaManager APIs to achieve that origin directories are
not created if they don't exist during datastore preparation, but the feature
is not easy to use and it's also not generalized enough for use in other quota
clients. Besides that, the way how it's currently done in LSNG complicates
removal of QuotaManager::EnsureTemporaryOriginIsInitializedInternal calls from
LSNG. This patch is about generalizing of the feature, making it available to
all quota clients.

Differential Revision: https://phabricator.services.mozilla.com/D195551
2024-10-10 12:22:55 +00:00
Jan Varga
55899a161a Bug 1866402 - Rename nsCStringHashKeyDM to nsCStringHashKeyWithDisabledMemmove; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D223302
2024-10-09 22:16:51 +00:00
Jan Varga
254757cad2 Bug 1866402 - Move nsCStringHashKeyDM to a dedicated hash keys header file; r=dom-storage-reviewers,jari
This removes some code duplication, but the primary motivation is to use it for
a member variable declaration in QuotaManager.h

Differential Revision: https://phabricator.services.mozilla.com/D195532
2024-10-09 22:16:51 +00:00
Jan Varga
a0ead95a6f Bug 1913561 - Remove QuotaManager::EnsureTemporaryStorageIsInitializedInternal calls from places where a directory lock is obtained via QuotaManager::OpenClientDirectory; r=dom-storage-reviewers,jari
QuotaManager::OpenClientDirectory already makes sure that temporary storage
is initialized so all these calls are now redundant.

Differential Revision: https://phabricator.services.mozilla.com/D195391
2024-10-06 02:01:00 +00:00
Jan Varga
f29b494041 Bug 1919556 - FS: Error out FileSystemBackgroundRequestHandler::CreateFileSystemManagerChild if the actor received CloseAll message; r=dom-storage-reviewers,jari
getDirectory currently fails with unknown error because the actor refuses to
send the GetRootHandle message. For accuracy, it would be better to explicitly
error out FileSystemBackgroundRequestHandler::CreateFileSystemManagerChild if
the actor already received the CloseAll message.

Differential Revision: https://phabricator.services.mozilla.com/D221711
2024-10-03 22:38:30 +00:00
Jan Varga
bb8a6b110c Bug 1919556 - FS: Call RequestAllowToClose on newly registered actors if the directory lock has been invalidated in the meantime; r=dom-storage-reviewers,jari
It can happen that FileSystemDataManager::AbortOperationsForLocks is called
during asynchronous CreateFileSystemManagerParent operation when the actor is
not yet registered. FileSystemDataManager::RequestAllowToClose is not able
to propagate the notification to the actor in that case. This patch fixes the
problem by checking directory lock and propagating the notification right after
a new actor has been registered.

Differential Revision: https://phabricator.services.mozilla.com/D220928
2024-10-03 22:38:30 +00:00
Jan Varga
dd3b50210c Bug 1919556 - FS: Call the callback immediately if there are no promises to settle in FileSystemManagerChild::CloseAllWritables; r=dom-storage-reviewers,jari
FileSystemManagerChild::CloseAllWritables is sometimes called from
FileSystemManager::Shutdown which can be called late in application shutdown
when GetCurrentSerialEventTarget returns null. At that point there are no
writable file streams and the problem with GetCurrentSerialEventTarget
returning null can be solved by calling the callback directly without
dispatching a new runnable.

Differential Revision: https://phabricator.services.mozilla.com/D221614
2024-10-03 22:38:29 +00:00
Jan Varga
174389c55c Bug 1919556 - FS: Convert FileSystemBackgroundRequestHandler::CreateFileSystemManagerChild to return a strong reference to the created object; r=dom-storage-reviewers,jari
mBackgroundRequestHandler->FileSystemManagerChildStrongRef() is currently
expected to return a non-null value when FileSystemManager::BeginRequest gets a
success for mBackgroundRequestHandler->CreateFileSystemManagerChild. It turns
out that's not always true because the child actor can get destroyed in the
mean time (FileSystemBackgroundRequestHandler::ClearActor is called). It would
be safer if FileSystemBackgroundRequestHandler::CreateFileSystemManagerChild
returned a strong reference to the created object.

Differential Revision: https://phabricator.services.mozilla.com/D220992
2024-10-03 22:38:29 +00:00
Jan Varga
8fcbda187e Bug 1919556 - Add a test for origin clearing requested right after starting database work for FS; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D220916
2024-10-03 22:38:28 +00:00
Jan Varga
03183a9c9a Bug 1919556 - FS: Add support for pausing QM IO thread after finishing database initialization; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D220516
2024-10-03 22:38:28 +00:00
Jan Varga
0e32b1614a Bug 1919556 - FS: Add a new testing only notification for database work starting; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D220515
2024-10-03 22:38:27 +00:00
Jan Varga
b53ebfb33a Bug 1919556 - FS: Add a pref for testing; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D220514
2024-10-03 22:38:27 +00:00
tannal
e70bfc694a Bug 1880789 - Remove dom.workers.modules.enabled pref. r=gregp,webidl,dom-worker-reviewers,saschanaz,dom-storage-reviewers,janv,yulia,asuth
Differential Revision: https://phabricator.services.mozilla.com/D223065
2024-09-24 10:48:13 +00:00
Jan Varga
d6946c7d87 Bug 1917479 - FS: Add handling for invalidated directory locks; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D219864
2024-09-18 04:34:19 +00:00
Jan Varga
dfa7f0ec23 Bug 1917479 - Add a test for origin clearing requested right after starting client directory opening for FS; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D219863
2024-09-18 04:34:19 +00:00
Jan Varga
347f22b7f3 Bug 1917479 - FS: Add mapping for NS_ABORT_ERROR; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D219862
2024-09-18 04:34:18 +00:00
Jan Varga
a4d2693441 Bug 1917169 - FS: Add a test for failing openDirectory operations; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D221400
2024-09-12 07:52:50 +00:00
Jan Varga
d523e45745 Bug 1915112 - Improve documentation for CheckedUnsafePtr usage in dom/fs; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D220345
2024-08-28 20:24:52 +00:00
Jan Varga
ec8fd962b5 Bug 1915112 - Change the move entry policy for FileSystemDataManagerHashKey; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D220344
2024-08-28 12:43:25 +00:00
Jan Varga
da9fd78405 Bug 1866217 - Replace some nsIQuotaManagerService::GetUsageForPrincipal calls with nsIQuotaManagerService::GetCachedUsageForPrincipal; r=dom-storage-reviewers,jari
There's now a dedicated nsIQuotaManagerService::GetCachedUsageForPrincipal
method for getting cached origin usage. All callers of
nsIQuotaManagerService::GetUsageForPrincipal which want to get cached origin
usage for given principal can be now converted to call the new method.

Differential Revision: https://phabricator.services.mozilla.com/D195363
2024-08-12 16:36:39 +00:00
Jan Varga
69b2ce187f Bug 1912414 - Make sure InitOrigin and GetUsageForOrigin are called as expected; r=dom-storage-reviewers,jari
InitOrigin is supposed to be called when temporary storage is not initialized
or is being initialized. On the other hand, GetUsageForOrigin is supposed to be
called only when temporary storage is already initialized.

Differential Revision: https://phabricator.services.mozilla.com/D194542
2024-08-11 21:40:20 +00:00
Jan Varga
d42b218203 Bug 1912414 - Remove TestFileSystemQuotaClient.cpp; r=dom-storage-reviewers,aiunusov,jari
The TestFileSystemQuotaClient test suite has been replacted with
TestFileSystemUsageTracking and TestFileSystemOriginInitialization test suites.

Differential Revision: https://phabricator.services.mozilla.com/D194540
2024-08-11 21:40:19 +00:00
Jan Varga
26fd2e5c1c Bug 1912414 - Create a dedicated test for origin initialization; r=dom-storage-reviewers,jari
The new test suite is intended for integration tests which verify origin
initialization. The suite is partially based on the existing
TestFileSystemQuotaClient suite.

TestFileSystemQuotaClient.cpp will get removed in a separate patch.

Differential Revision: https://phabricator.services.mozilla.com/D166175
2024-08-11 10:18:51 +00:00
Jan Varga
8556083bde Bug 1912414 - Add more helpers to FileSystemParentTest; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D194536
2024-08-11 10:18:50 +00:00
Jan Varga
22f0533bf0 Bug 1912414 - Add GetTestClientMetadata function; r=hsingh
Differential Revision: https://phabricator.services.mozilla.com/D194533
2024-08-11 10:18:50 +00:00
Jan Varga
b760d057cc Bug 1912414 - Move parent test fixture to separate files; r=aiunusov
Differential Revision: https://phabricator.services.mozilla.com/D194502
2024-08-11 10:18:49 +00:00
Jan Varga
b4ec904bdf Bug 1912414 - Final cleanup of TestFileSystemUsageTracking.cpp; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D194487
2024-08-10 22:29:07 +00:00
Jan Varga
1627627fc9 Bug 1912414 - Execute test operations on the right thread; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D194485
2024-08-10 22:29:07 +00:00
Jan Varga
ba2be433e4 Bug 1912414 - Replace FileSystemQuotaClient::InitOrigin calls with FileSystemDatabaseManager::GetUsage calls; r=dom-storage-reviewers,jari
FileSystemQuotaClient::InitOrigin shouldn't be called when temporary storage is
already initialized. It shouldn't be called when there's already active storage
connection for the OPFS database either.

Differential Revision: https://phabricator.services.mozilla.com/D194467
2024-08-10 22:29:06 +00:00
Jan Varga
ac3eed88db Bug 1912414 - Init quota manager fixture only once during TestFileSystemUsageTracking test suite; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D194466
2024-08-10 22:29:06 +00:00
Jan Varga
1bffefad98 Bug 1912414 - Introduce TestFileSystemUsageTracking.cpp; r=dom-storage-reviewers,jari
The new test suite is intended for integration tests which verify usage
tracking without any restart in between. The suite is based on the existing
TestFileSystemQuotaClient suite except the test which in theory request a
restart in between: TrackedFilesOnInitOriginShouldCauseRescan.

TestFileSystemQuotaClient.cpp will get removed after some additional
refactoring.

Differential Revision: https://phabricator.services.mozilla.com/D194465
2024-08-10 06:56:49 +00:00
Jan Varga
2b727707d5 Bug 1912414 - Move parent test helpers to separate files; r=dom-storage-reviewers,jari
Some helper methods have been also generalized to work with any origin.

Differential Revision: https://phabricator.services.mozilla.com/D194463
2024-08-10 06:56:49 +00:00
Jan Varga
8b7311fa3f Bug 1912414 - Clean up include declarations in TestFileSystemQuotaClient.cpp; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D194462
2024-08-10 06:56:49 +00:00