Commit Graph

1610 Commits

Author SHA1 Message Date
Jens Stutte
6dfca922cc Bug 1727526 - Have a Stringifyable base class. r=dom-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D191082
2023-12-11 15:17:12 +00:00
Jan Varga
cb45ede81b Bug 1808294 - Add DirectoryLock::Acquired method; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D192444
2023-12-08 05:55:05 +00:00
Jan Varga
e97b14d308 Bug 1808294 - Add QuotaManager::InitializeTemporaryStorage method; r=dom-storage-reviewers,jari
There's currently EnsureTemporaryStorageIsInitializedInternal which can only be
called on the QuotaManager IO thread. That method shouldn't be exposed to quota
clients and origin operations. There should be a public method callable from
the PBackground thread returning a MozPromise instead. Such method will
guarantee that proper directory locking is acquired before temporary storage
initialization is started.

Differential Revision: https://phabricator.services.mozilla.com/D192135
2023-12-08 05:55:05 +00:00
Jan Varga
938370b55e Bug 1808294 - Rename EnsureTemporaryStorageIsInitialized to EnsureTemporaryStorageIsInitializedInternal; r=dom-storage-reviewers,asuth
One of the goals of the asynchronous temporary storage initialization is to
call EnsureTemporaryStorageIsInitialized only from InitTemporaryStorageOp.
Calling from other places including quota clients will be disallowed by
changing the method to a private method. The private nature of the method
should be emphasized by adding the Internal suffix.

Differential Revision: https://phabricator.services.mozilla.com/D188332
2023-12-08 05:55:04 +00:00
Jan Varga
c876dd2cf3 Bug 1808294 - Rename storage initialization checking QuotaManagerDependencyFixture methods; r=dom-storage-reviewers,jari,hsingh
QuotaManagerDependencyFixture::IsStorageInitialized now uses
QuotaManager::StorageInitialized, so it makes sense to remove "Is" from all
storage initialization checking methods as well.

Differential Revision: https://phabricator.services.mozilla.com/D191933
2023-12-08 05:55:04 +00:00
Jan Varga
b2dba30809 Bug 1808294 - Change QuotaManagerDependencyFixture::IsStorageInitialized to use QuotaManager::StorageInitialized instead of QuotaManager::IsStorageInitialized; r=dom-storage-reviewers,jari,hsingh
QuotaManager::StorageInitialized is the primary source of truth.
QuotaManager::IsStorageInitialized only synchronously checks a flag which
shadows the primary state on the QuotaManager IO thread. Calling an async
method better matches other QuotaManagerDependencyFixture methods.

Differential Revision: https://phabricator.services.mozilla.com/D191932
2023-12-08 05:55:04 +00:00
Jan Varga
5405995e1c Bug 1808294 - Rework QuotaManagerService::StorageInitialized and QuotaManager::TemporaryStorageInitialized to use asynchronous messages instead of creating sub actors; r=dom-storage-reviewers,jari
This patch also adds QuotaManager::StorageInitialized and
QuotaManager::TemporaryStorageInitialized which can be then used by the
QuotaManagerDependencyFixture.

Differential Revision: https://phabricator.services.mozilla.com/D191930
2023-12-08 05:55:03 +00:00
Jan Varga
3d32b14abc Bug 1808294 - Rename QuotaManagerDependencyFixture::StorageInitialized to EnsureQuotaManager and make it private; r=dom-storage-reviewers,jari
The method is currently only used for ensuring that quota manager exists, so the new name reflects that.

Differential Revision: https://phabricator.services.mozilla.com/D191927
2023-12-08 05:55:03 +00:00
Jan Varga
3d0a65f1eb Bug 1808294 - Change QuotaManagerDependencyFixture::ClearStoragesForOrigin to call QuotaManager::ClearStoragesForOrigin directly; r=dom-storage-reviewers,jari
There's now a dedicated method QuotaManager::ClearStoragesForOrigin which can
be called in the parent process directly, so the fixture doesn't have to use
IPC for clearing origins anymore.

Differential Revision: https://phabricator.services.mozilla.com/D191915
2023-12-08 05:55:02 +00:00
Jan Varga
65f9749341 Bug 1864264 - Create a base class for quota manager and quota client marionette tests; r=dom-storage-reviewers,webdriver-reviewers,whimboo,hsingh,asuth
Differential Revision: https://phabricator.services.mozilla.com/D193354
2023-12-05 01:34:04 +00:00
hsingh
b4f96b0521 Bug 1867394: Zero-initialize first EncryptedBlock.r=asuth,dom-storage-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D195249
2023-12-04 21:51:22 +00:00
Jan Varga
565db2a48e Bug 1866240 - Maintain usage information in the database; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D195081
2023-12-01 22:38:10 +00:00
Jan Varga
d747f45a68 Bug 1867095 - Make it possible to use cached quota information even when last access time information mismatches; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D194915
2023-11-28 21:01:37 +00:00
Joel Maher
28be3ac6b4 Bug 1859890 - batch 14 convert xpcshell.ini -> .toml. r=aryx,dom-storage-reviewers,jesup
Differential Revision: https://phabricator.services.mozilla.com/D194162
2023-11-28 01:02:01 +00:00
Jan Varga
d26ddce442 Bug 1864123 - Optimize flushing to base stream; r=dom-storage-reviewers,asuth,hsingh
Differential Revision: https://phabricator.services.mozilla.com/D193286
2023-11-24 10:02:29 +00:00
Jan Varga
5aaccd702f Bug 1864798 - QuotaManager::ParseOrigin returns incomplete PrincipalInfo; r=valentin
Differential Revision: https://phabricator.services.mozilla.com/D193626
2023-11-15 10:09:22 +00:00
hsingh
a68c2ad072 Bug 1835298: Encrypt CacheAPI data on disk in PBM.r=dom-storage-reviewers,janv
Depends on D180296

Differential Revision: https://phabricator.services.mozilla.com/D180297
2023-10-27 14:10:08 +00:00
Jari Jalkanen
9ca4cc586f Bug 1791767 - Exclude CachingDatabaseConnection with event target from general thread checks. r=dom-storage-reviewers,janv
CachingDatabaseConnection relies on a global macro to toggle thread
ownership checks. The checks do not work with thread pool event targets
and by this change we ensure that the global macro users are not
impacted by such event target changes.

Depends on D190598

Differential Revision: https://phabricator.services.mozilla.com/D190601
2023-10-16 07:43:11 +00:00
Sylvestre Ledru
d0f6c7fc66 Bug 1856795 - Remove redundant member init r=emilio
Done with:
./mach static-analysis check --checks="-*, readability-redundant-member-init" --fix .

https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-member-init.html

Differential Revision: https://phabricator.services.mozilla.com/D190002
2023-10-15 15:29:02 +00:00
Cristina Horotan
6a90f5eded Backed out 2 changesets (bug 1856795) for causing build bustage at BasicEvents.h CLOSED TREE
Backed out changeset 1d98b028923a (bug 1856795)
Backed out changeset eae2ac93e17c (bug 1856795)
2023-10-14 21:42:14 +03:00
Sylvestre Ledru
cc8a0ee742 Bug 1856795 - Remove redundant member init r=emilio
Done with:
./mach static-analysis check --checks="-*, readability-redundant-member-init" --fix .

https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-member-init.html

Differential Revision: https://phabricator.services.mozilla.com/D190002
2023-10-14 17:34:26 +00:00
Jan Varga
7a7f6bd63c Bug 1808294 - Create a dedicated factory for FileSystemQuotaClient; r=dom-storage-reviewers,jari
The new class supports setting a custom factory, so tests can use it for
overriding the quota client implementation.

Differential Revision: https://phabricator.services.mozilla.com/D165851
2023-10-14 05:12:05 +00:00
Mark Banner
e43869f6d6 Bug 1857866 - Enable ESLint rule mozilla/reject-importGlobalProperties on all of dom/. r=dom-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D190434
2023-10-13 08:56:11 +00:00
Noemi Erli
e5c9fdc125 Backed out 6 changesets (bug 1857866) for causing mochitest failures in test_bug403852.html CLOSED TREE
Backed out changeset d3a20047a9d3 (bug 1857866)
Backed out changeset ac8e95c253a9 (bug 1857866)
Backed out changeset c2d4c9575248 (bug 1857866)
Backed out changeset 521a5e8cb17e (bug 1857866)
Backed out changeset 8d812ea48f5c (bug 1857866)
Backed out changeset de9146469632 (bug 1857866)
2023-10-13 00:27:57 +03:00
Mark Banner
3ad8e86d7c Bug 1857866 - Enable ESLint rule mozilla/reject-importGlobalProperties on all of dom/. r=dom-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D190434
2023-10-12 16:49:47 +00:00
Jan Varga
6e5e0c9706 Bug 1808294 - Add a common way to create quota client directories; r=dom-storage-reviewers,jari
Depends on D166173

Differential Revision: https://phabricator.services.mozilla.com/D166174
2023-10-12 14:55:59 +00:00
Jan Varga
a9bfae6bf6 Bug 1858067 - Skip saving of origin access time during shutdown; r=dom-storage-reviewers,jstutte
Differential Revision: https://phabricator.services.mozilla.com/D190541
2023-10-10 08:49:53 +00:00
Jens Stutte
fe39c9b27a Bug 1857858 - Add a shutdown annotation to ShutdownStorageOp::DoDirectoryWork. r=dom-storage-reviewers,janv
Operations are shown as "pending" in the QM shutdown hang annotations until they are fully executed. Given that executing them often requires acquiring a directory lock first and also involves some thread hopping, we want to understand better, where we hang.

In particular many crashes show `ShutdownStorageOp` as pending but there is no sign in the stack trace that `DoDirectoryWork` ever started. In addition, most if not all of those crashes show either an open IDB connection or an unclosed  Cache manager, which might interfere with directory locking here.

The annotation should help to confirm that `ShutdownStorageOp` is endlessly waiting to acquire the directory lock in those cases.

Differential Revision: https://phabricator.services.mozilla.com/D190425
2023-10-09 09:34:31 +00:00
Jan Varga
39b44622e6 Bug 1808294 - Extend nsIQuotaOriginUsageResult to match UsageInfo; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D166173
2023-10-06 13:33:13 +00:00
Jens Stutte
109482b93c Bug 1856089 - Harden RequestResolver::ResolveOrReject against a race with WorkerRef::Notify. r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D190030
2023-10-04 15:15:03 +00:00
Tom Marble
faa34b0552 Bug 1855296 - convert .ini manifests to .toml: batch 9 dom/[m-s]**/mochitest.ini r=jmaher,media-playback-reviewers,alwu
Differential Revision: https://phabricator.services.mozilla.com/D189845
2023-10-03 19:35:22 +00:00
Jan Varga
c458754592 Bug 1855134 - Move existing MOZ_TRY macros to a dedicated header file; r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D189226
2023-09-28 20:46:07 +00:00
Valentin Gosu
6e44a3e179 Bug 1553105 - Make URL.origin return "null" if protocol doesn't have the URI_HAS_WEB_EXPOSED_ORIGIN flag r=nika,necko-reviewers,kershaw
CLOSED TREE

Differential Revision: https://phabricator.services.mozilla.com/D188720
2023-09-27 10:29:17 +00:00
Cosmin Sabou
f9a78f449a Backed out changeset c4a317778310 (bug 1553105) for causing build bustages on nsContentUtils.cpp. CLOSED TREE 2023-09-27 13:25:14 +03:00
Valentin Gosu
2a9f09daff Bug 1553105 - Make URL.origin return "null" if protocol doesn't have the URI_HAS_WEB_EXPOSED_ORIGIN flag r=nika,necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D188720
2023-09-27 09:55:57 +00:00
Jan Varga
55868a9a44 Bug 1854302 - Add testing for mozIStorageConnection::GetQuotaObjects; r=hsingh
Differential Revision: https://phabricator.services.mozilla.com/D188793
2023-09-26 14:51:39 +00:00
Jan Varga
1fe7a61834 Bug 1733107 - Avoid repository traversals during clearing of exact origins; r=dom-storage-reviewers,asuth
ClearRequestBase::DeleteFiles currently provides a way to clear origins for any
combination of persistence type, origin scope and client type. All origin
directories need to be traversed to find relevant matches. This can be slow if
there are many origin directories. Fortunately, the traversal can be completely
avoided when exact origin is being cleared.

Changes done in this patch:
- added a dedicated ClearRequestBase::DeleteFiles method for clearing of exact
  origins
- changed ClearOriginOp::DoDirectoryWork to use the new variant of
  ClearRequestBase::DeleteFiles

Differential Revision: https://phabricator.services.mozilla.com/D186781
2023-09-25 16:28:40 +00:00
Jan Varga
0806548c36 Bug 1733107 - Add QuotaManager::RemoveOriginDirectory; r=dom-storage-reviewers,asuth
The removing of an origin directory became a bit more complex because when the
app shutdown already started, origin directories shouldn't be fully removed
from disk. They need to be only moved to a special directory. All this
complexity should be covered by a dedicated QuotaManager method.

Changes done in this patch:
- added a new method QuotaManager::RemoveOriginDirectory
- added a prefilled string for the special to-be-removed directory
- adjusted ClearRequestBase::DeleteFiles to use the new
  QuotaManager::RemoveOriginDirectory method

Differential Revision: https://phabricator.services.mozilla.com/D186780
2023-09-25 16:28:39 +00:00
Jan Varga
72434a1513 Bug 1733107 - Change nsIQuotaManagerService::ClearStoragesForPrincipal to support clearing of exact origins only; r=dom-storage-reviewers,asuth
There are now no callers of nsIQuotaManagerService::ClearStoragesForPrincipal
which would request clearing of all storages for given prefix. The support for
that can be removed.

Changed done in this patch:
- removed the aClearAll argument from
  nsIQuotaManagerService::ClearStoragesForPrincipal
- removed the aClearAll argument from the async IPC message
- removed the aClearAll argument from QuotaManager::ClearStoragesForOrigin
- changed ClearOriginOp to support clearing of exact origins only

Differential Revision: https://phabricator.services.mozilla.com/D186779
2023-09-25 16:28:39 +00:00
Jan Varga
9d6a8b0cb8 Bug 1733107 - Add nsIQuotaManagerService::ClearStoragesForOriginPrefix; r=dom-storage-reviewers,asuth,jstutte
nsIQuotaManagerService::ClearStoragesForPrincipal currently supports both
clearing storages for a specific origin only and clearing storages for a group
of origins sharing the same prefix. It would be better to have separate methods
for this.

Changes done in this patch:
- added nsIQuotaManagerService::ClearStoragesForOriginPrefix
- added a new helper for testing clearOriginsByPrefix
- changed verifyStorage to accept an optional shared key name
- added thorough testing for the new method

Differential Revision: https://phabricator.services.mozilla.com/D186777
2023-09-25 16:28:38 +00:00
Jan Varga
b3f56d4188 Bug 1733107 - Rework remaining QuotaManagerService clearing methods to use asynchronous messages instead of creating sub actors; r=dom-storage-reviewers,jstutte
QuotaManagerService::ClearStoragesForOriginAttributesPattern and
QuotaManagerService::ClearStoragesForPrincipal still create sub actors which
makes it hard to add new clearing operations which would use async IPC messages
and which would inherit from the ClearRequestBase class as well.

Changes done in this patch:
- added QuotaManager::ClearStoragesForOrigin
- added QuotaManager::ClearStoragesForOriginAttributesPattern
- changed ClearRequestBase to inherit from ResolvableNormalOriginOp
- QuotaManagerService::ClearStoragesForOriginAttributesPattern reworked to use
  an asynchronous message instead of a sub actor
- QuotaManagerService::ClearStoragesForPrincipal reworked to use an
  asynchronous message instead of a sub actor
- added a new mactor QM_CUF_AND_IPC_FAIL similar to QM_IPC_FAIL

creating a sub actor

Differential Revision: https://phabricator.services.mozilla.com/D186628
2023-09-25 16:28:38 +00:00
Jan Varga
34e0e8625a Bug 1733107 - Move directory locking to derived classes of ClearRequestBase; r=dom-storage-reviewers,jstutte
ClearRequestBase currently provides generic directory locking based on generic
member variables. It's not totally clear what derived classes do in terms of
directory locking and work on the QuotaManager IO thread. It would be better if
ClearRequestBase only provided a generic DeleteFiles function instead.

Changed done in this patch:
- moved implementation of directory locking methods to derived classes of
  ClearRequestBase
- moved implementation of DoDirectoryWork to derived classes as well
- adjusted member variables

Differential Revision: https://phabricator.services.mozilla.com/D186627
2023-09-25 16:28:37 +00:00
Tom Marble
a99a113414 Bug 1853244 - convert .ini manifests to .toml: batch 6 {caps,devtools,dom}/**/browser.ini r=jmaher,media-playback-reviewers,devtools-reviewers,profiler-reviewers,alwu,nchevobbe,canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D188856
2023-09-22 20:42:14 +00:00
Jan Varga
eb8cfe719f Bug 1749504 - Change QuotaManager::EnsureStorageIsInitializedInternal to be a private method; r=dom-storage-reviewers,jstutte
The goal to call QuotaManager::EnsureStorageIsInitializedInternal only from
InitOp has been achieved. It's now easy to change the method to be a private
method.

Changes done in this patch
- moved InitOp to the mozilla::dom::quota namespace
- added InitOp as a friend to QuotaManager
- changed QuotaManager::EnsureStorageIsInitializedInternal to be a private
   method

Differential Revision: https://phabricator.services.mozilla.com/D186208
2023-09-20 10:37:45 +00:00
Jan Varga
3a2a55bda1 Bug 1749504 - Convert TestFileOutputStream to use the new way to access a client directory; r=dom-storage-reviewers,jstutte
TestFileOutputStream currently doesn't create any client directory lock and
just directly bounces to the QuotaManager I/O thread where it ensures that
storage is initialized. This should be now replaced by calling
QuotaManager::OpenClientDirectory on the PBackground thread.

Changes done in this patch:
- added a PBackground task which is executed first
- added QuotaManager::OpenClientDirectory call on the PBackground thread
- removed QuotaManager::EnsureStorageIsInitializedInternal call on the IO
  thread

Differential Revision: https://phabricator.services.mozilla.com/D186207
2023-09-20 10:37:45 +00:00
Jan Varga
dc25d97144 Bug 1749504 - Convert origin operations which require storage initialization to use the new way to access the storage directory; r=dom-storage-reviewers,jstutte
Origin operations which require storage initialization currently create a
universal directory lock first and then when the universal directorylock is
acquired, they bounce to the QuotaManager I/O thread where they ensure that
storage is initialized. This can be now replaced by just calling
QuotaManager::OpenStorageDirectory.

Changes done in this patch:
- replaced QuotaManager::CreateDirectoryLockInternal call with
  QuotaManager::OpenStorageDirectory in corresponding OpenDirectory
  implementations
- removed QuotaManager::EnsureStorageIsInitializedInternal call from
  corresponding DoDirectoryWork implementations
- added QuotaManager::AssertStorageIsInitializedInternal to corresponding
  DoDirectoryWork implementations

Differential Revision: https://phabricator.services.mozilla.com/D186206
2023-09-20 10:37:44 +00:00
Jan Varga
d2162e1c48 Bug 1749504 - Make sure storage is initialized before saving origin access time; r=dom-storage-reviewers,jstutte
SaveOriginAccessTimeOp::DoDirectoryWork currently doesn't call
QuotaManager::EnsureStorageIsInitializedInternal and just expects that
something else initialized storage previously. This seems to work, but it would
be cleaner to always make sure that storage is initialized. However, adding
QuotaManager::EnsureStorageIsInitializedInternal revealed another problem.
Storage shudown or storage clearing acquires an exlusive lock over entire
storage area which essentially forces that all existing directory locks are
released first. When the last directory lock for an origin is released, saving
of origin access time is scheduled. The problem is that it's scheduled after
the exclusive lock for storage shutdown or storage clearing, so storage would
be initialized again in the end or access time wouldn't be saved at all due
to quota manager shutdown being already in progress.

Changes done in this patch:
- added QuotaManager::EnsureStorageIsInitializedInternal call to
  SaveOriginAccessTimeOp::DoDirectoryWork
- changed QuotaManager::UnregisterDirectoryLock to work with already cleared
  directory lock tables
- added a new QuotaManager::ClearDirectoryLockTables method
- added QuotaManager::ClearDirectoryLockTables call to
  ShutdownStorageOp::OpenDirectory and ClearStorageOp::OpenDirectory
- made ClearStorageOp and ShutdownStorageOp friend classes of QuotaManager

Differential Revision: https://phabricator.services.mozilla.com/D187877
2023-09-20 10:37:44 +00:00
Gregory Pappas
7c785df7d9 Bug 1853841 - Remove dom.storageManager.enabled pref r=webidl,smaug,dom-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D188554
2023-09-20 08:38:54 +00:00
Jan Varga
df72361673 Bug 1824075 - Add telemetry for time spent in quota manager shutdown; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D186603
2023-09-19 00:38:01 +00:00
Jan Varga
5782b1504f Bug 1824075 - Allow RecordTimeDeltaHelper to be used on the PBackground thread as well; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D173405
2023-09-19 00:38:01 +00:00