Commit Graph

124 Commits

Author SHA1 Message Date
hsingh
c294efd51a Bug 1871409: Moved back mInitRunnable clearing in Context::OnQuotaInit to its prior position.r=janv
Differential Revision: https://phabricator.services.mozilla.com/D197155
2023-12-22 16:18:13 +00:00
hsingh
33a724513a Bug 1869087: Properly handle QuotaInitRunnable failure in Context::OnQuotaInit.r=dom-storage-reviewers,janv
QuotaInitRunnable is invoked by Context to set up cache directory. This is not always successful as it could be
interrupted by shutdown or other filesystem issues. By the time in ran into error, it's possible that some objects
needed by Context are not yet initialized in QuotaInitRunnable::Run. Since QuotaInitRunnable internal state machine
will always transition to 'COMPLETING' and Context::OnQuotaInit would always be called; it's possible that some objects
like mDirectoryLock, mCipherKeyManager and mDirectoryMetadata didn't get initialized yet. As an effect, we should
only assert these objects being non-null in Context::OnQuotaInit if the QuotaInitRunnable was successful.

Differential Revision: https://phabricator.services.mozilla.com/D196113
2023-12-14 16:31:23 +00:00
Norisz Fay
a2413a9e0c Backed out changeset 04b0ed50a187 (bug 1869087) for causing multiple Quota related failures 2023-12-14 01:00:28 +02:00
hsingh
ec4cbf2fc7 Bug 1869087: Properly handle QuotaInitRunnable failure in Context::OnQuotaInit.r=dom-storage-reviewers,janv
QuotaInitRunnable is invoked by Context to set up cache directory. This is not always successful as it could be
interrupted by shutdown or other filesystem issues. By the time in ran into error, it's possible that some objects
needed by Context are not yet initialized in QuotaInitRunnable::Run. Since QuotaInitRunnable internal state machine
will always transition to 'COMPLETING' and Context::OnQuotaInit would always be called; it's possible that some objects
like mDirectoryLock, mCipherKeyManager and mDirectoryMetadata didn't get initialized yet. As an effect, we should
only assert these objects being non-null in Context::OnQuotaInit if the QuotaInitRunnable was successful.

Differential Revision: https://phabricator.services.mozilla.com/D196113
2023-12-13 18:24:33 +00:00
Noemi Erli
c670ce0ba6 Backed out changeset f47f48be162a (bug 1869087) for causing crashes in StorageControllerTest CLOSED TREE 2023-12-13 05:46:07 +02:00
hsingh
08b837e173 Bug 1869087: Properly handle QuotaInitRunnable failure in Context::OnQuotaInit.r=dom-storage-reviewers,janv
QuotaInitRunnable is invoked by Context to set up cache directory. This is not always successful as it could be
interrupted by shutdown or other filesystem issues. By the time in ran into error, it's possible that some objects
needed by Context are not yet initialized in QuotaInitRunnable::Run. Since QuotaInitRunnable internal state machine
will always transition to 'COMPLETING' and Context::OnQuotaInit would always be called; it's possible that some objects
like mDirectoryLock, mCipherKeyManager and mDirectoryMetadata didn't get initialized yet. As an effect, we should
only assert these objects being non-null in Context::OnQuotaInit if the QuotaInitRunnable was successful.

Differential Revision: https://phabricator.services.mozilla.com/D196113
2023-12-13 00:57:19 +00:00
Jens Stutte
09e51b5d0e Bug 1727526 - Add more details to Context::Stringify. r=dom-storage-reviewers,janv
Depends on D191082

Differential Revision: https://phabricator.services.mozilla.com/D191084
2023-12-11 15:17:12 +00:00
Jens Stutte
349c746a19 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
c3f18dd105 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
hsingh
c80ea97d51 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
Jens Stutte
b888688e6f Bug 1727526 - Add more information to cache manager shutdown hang annotations. r=dom-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D190795
2023-10-13 12:16:26 +00:00
Jan Varga
6d794d3895 Bug 1749504 - Convert Cache API to use the new way to access a client directory; r=dom-storage-reviewers,jstutte
Cache API  currently creates a client directory lock first and then when the
client directorylock is acquired, it bounces to the QuotaManager I/O thread
where it ensures that storage is initialized. This can be now replaced by just
calling QuotaManager::OpenClientDirectory.

Changes done in this patch:
- replaced QuotaManager::CreateDirectoryLock call with
  QuotaManager::OpenClientDirectory
- removed EnsureStorageIsInitializedInternal call from
  Context::QuotaInitRunnable::Run
- changed Context::QuotaInitRunnable to not inherit from OpenDirectoryListener

Differential Revision: https://phabricator.services.mozilla.com/D186119
2023-09-16 12:45:41 +00:00
Jan Varga
7a036fc598 Bug 1749504 - Simplify signature of QuotaManager::CreateDirectoryLock; r=dom-storage-reviewers,jstutte
CreateDirectoryLock currently takes three separate arguments which can be
expressed as just one argument.

Changes done in this patch:
- QuotaManager::CreateDirectoryLock changed to take just client metadata
- all call sites updated to reflect the changed signature

Differential Revision: https://phabricator.services.mozilla.com/D185568
2023-09-12 12:40:41 +00:00
Jan Varga
6555388d94 Bug 1749504 - Rename EnsureStorageIsInitialized to EnsureStorageIsInitializedInternal; r=dom-storage-reviewers,jstutte
One of the goals of bug 1749504 is to call EnsureStorageIsInitialized only from
InitOp. 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.

Changes done in this patch:
- IsStorageInitialized renamed to IsStorageInitializedInternal
- AssertStorageIsInitialized renamed to AssertStorageIsInitializedInternal
- EnsureStorageIsInitialized renamed to EnsureStorageIsInitializedInternal

Differential Revision: https://phabricator.services.mozilla.com/D185547
2023-09-12 12:40:41 +00:00
Jan Varga
dc926465ba Bug 1781201 - Change GetInfoFromValidatedPrincipalInfo to be fallible; r=hsingh
The generation of unique anonynmous origins can fail, so the method needs to be
fallible as well, otherwise the failures couldn't be propagated.

Differential Revision: https://phabricator.services.mozilla.com/D176874
2023-05-03 08:22:56 +00:00
Jan Varga
8cfc1d53bc Bug 1781201 - Convert GetInfoFromValidatedPrincipalInfo to a non-static method; r=hsingh
The method will need to access members of the QuotaManager class, so it can't
be static anymore.

Differential Revision: https://phabricator.services.mozilla.com/D176872
2023-05-03 08:22:55 +00:00
Jan Varga
55ef85416c Bug 1781201 - Stop using GetInfoFromPrincipal in the parent; r=hsingh
Quota clients should use GetInfoFromValidatedPrinciplaInfo in the parent
because that method will eventually generate unique anonymous origins for
private browsing.
This patch also moves some calls from the main thread to the PBackground thread
because GetInfoFromValidatedPrinciplaInfo can run on any thread.

Differential Revision: https://phabricator.services.mozilla.com/D176871
2023-05-03 02:05:11 +00:00
Nika Layzell
ccbdb42273 Bug 1809753 - Part 3: Replace all callers of GetCurrentEventTarget with GetCurrentSerialEventTarget, r=mccr8,necko-reviewers,valentin
This only changes the behaviour when called with a TaskQueue or other type
using SerialEventTargetGuard on the stack. They are being switched over as the
existing GetCurrentEventTarget method is being removed, as it is somewhat
confusing, and poorly documented.

Callers which need to get the current thread even when on a threadpool or
behind a TaskQueue were switched to GetCurrentEventTarget in the previous part.

Differential Revision: https://phabricator.services.mozilla.com/D166607
2023-01-16 23:14:11 +00:00
Sandor Molnar
f236c54e45 Backed out 6 changesets (bug 1809752, bug 1809753) for causing perma failures in browser/components/firefoxview/tests/browser/browser_feature_callout_position.js
Backed out changeset ea05784d74c4 (bug 1809753)
Backed out changeset 7c9b20eebcc8 (bug 1809753)
Backed out changeset d0267ac2256d (bug 1809753)
Backed out changeset aa9f2971bd6f (bug 1809753)
Backed out changeset f0d9fcfaa6f8 (bug 1809752)
Backed out changeset 6d58c799cffe (bug 1809752)
2023-01-17 03:19:24 +02:00
Nika Layzell
21081c63fa Bug 1809753 - Part 3: Replace all callers of GetCurrentEventTarget with GetCurrentSerialEventTarget, r=mccr8,necko-reviewers,valentin
This only changes the behaviour when called with a TaskQueue or other type
using SerialEventTargetGuard on the stack. They are being switched over as the
existing GetCurrentEventTarget method is being removed, as it is somewhat
confusing, and poorly documented.

Callers which need to get the current thread even when on a threadpool or
behind a TaskQueue were switched to GetCurrentEventTarget in the previous part.

Differential Revision: https://phabricator.services.mozilla.com/D166607
2023-01-16 23:14:11 +00:00
Jan Varga
190a2c3969 Bug 1791755 - Extract OriginInfo, GroupInfo, GroupInfoPair and QuotaObject into separate source files; r=dom-storage-reviewers,jesup
Differential Revision: https://phabricator.services.mozilla.com/D157815
2022-10-28 08:22:49 +00:00
Jan Varga
3e73e7ce93 Bug 1731960 - Move all Result extensions from QMResult.h to a dedicated file; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D126324
2021-11-30 05:05:51 +00:00
Haiyang Xu
2609a9be23 Bug 1726809 - Simplify QuotaManager::GetOrCreate and intermediate state of opening QuotaManager; r=dom-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D131592
2021-11-28 00:09:56 +00:00
Butkovits Atila
2dd947aa8c Backed out changeset b4b0ae95055b (bug 1726809) for causing build bustages at ActorsParent.cpp. CLOSED TREE 2021-11-26 12:02:18 +02:00
Haiyang Xu
b52b5893f5 Bug 1726809 - Simplify QuotaManager::GetOrCreate and intermediate state of opening QuotaManager; r=dom-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D131592
2021-11-26 09:20:57 +00:00
Haiyang Xu
79af612655 Bug 1672140 - Rename cache::ClientMetadata to cache::CacheDirectoryMetadata; r=dom-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D131590
2021-11-24 20:50:37 +00:00
hxu
d2301973ac Bug 1672140 - Change cache::ClientMetadata's base class from quota::OriginMetadata to quota::ClientMetadata; r=dom-storage-reviewers,janv
Depends on D125583

Differential Revision: https://phabricator.services.mozilla.com/D126056
2021-11-24 20:50:37 +00:00
hxu
6940518aa5 Bug 1672140 - Rename cache::QuotaInfo to cache::ClientMetadata and rename corresponding functions; r=dom-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D125583
2021-11-24 20:50:36 +00:00
Butkovits Atila
2972038726 Backed out 3 changesets (bug 1672140) for causing Bp-hybrid build bustages.
Backed out changeset 32edbc243607 (bug 1672140)
Backed out changeset 549556f430a7 (bug 1672140)
Backed out changeset 396640d13ece (bug 1672140)
2021-11-23 20:25:56 +02:00
Haiyang Xu
83543e511c Bug 1672140 - Rename cache::ClientMetadata to cache::CacheDirectoryMetadata; r=dom-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D131590
2021-11-23 16:53:50 +00:00
hxu
0034188532 Bug 1672140 - Change cache::ClientMetadata's base class from quota::OriginMetadata to quota::ClientMetadata; r=dom-storage-reviewers,janv
Depends on D125583

Differential Revision: https://phabricator.services.mozilla.com/D126056
2021-11-23 16:53:50 +00:00
hxu
0ddf5a9d23 Bug 1672140 - Rename cache::QuotaInfo to cache::ClientMetadata and rename corresponding functions; r=dom-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D125583
2021-11-23 16:53:49 +00:00
Jan Varga
bbfd5be8cd Bug 1728267 - Remove implicit ToResult from QM_TRY when no extra argument is passed in dom/cache; r=dom-storage-reviewers,jstutte,jari
Differential Revision: https://phabricator.services.mozilla.com/D125319
2021-09-24 13:08:30 +00:00
hxu
736a44380b Bug 1727497 - Add MOZ_ALWAYS_SUCCEEDS when calling dispatch functions during dom/cache shutdown; r=dom-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D125071
2021-09-17 14:07:43 +00:00
Jan Varga
8ab617a8fd Bug 1711180 - Refactor code for handling STATE_GET_INFO in Context::QuotaInitRunnable::Run; r=dom-storage-reviewers,jstutte
This eliminates the need for using andThen and orElse. This is now consistent
with hanling of STATE_ENSURE_ORIGIN_INITIALIZED.

Differential Revision: https://phabricator.services.mozilla.com/D115127
2021-05-22 06:21:12 +00:00
Jan Varga
f35732b709 Bug 1709067 - CACHE: Remove module specific QM_TRY macros; r=dom-storage-reviewers,jstutte
Depends on D114080

Differential Revision: https://phabricator.services.mozilla.com/D114081
2021-05-03 19:44:39 +00:00
Jan Varga
84413fc6f9 Bug 1686031 - Add mPersistenceType to OriginMetadata; r=dom-storage-reviewers,sg
The existing members of OriginMetadata have been extracted to a parent struct
called PrincipalMetadata. Methods like GetOriginUsage,
GetInfoFromValidatedPrincipalInfo, GetInfoFromPrincipal and GetInfoForChrome
have been changed to take/return PrincipalMetadata instead of OriginMetadata.
Having the persistence type doesn't make sense in those methods because the
origin is not tied to a specific persistence type in context of the methods.

Some places temporarily pass PERSISTENCE_TYPE_INVALID and will be fixed in
following patches.

Differential Revision: https://phabricator.services.mozilla.com/D106400
2021-03-04 18:03:02 +00:00
Jan Varga
417fd9bd4f Bug 1686031 - Fold QuotaInfo into OriginMetadata and rename QuotaInfo.h to OriginMetadata.h; r=dom-storage-reviewers,sg
Existing uses of OriginMetadata (with only mGroup and mOrigin) have been
adapted and they now always initialize mSuffix to an empty string.
Following patches will change it to real suffix if there's any.

Differential Revision: https://phabricator.services.mozilla.com/D104971
2021-02-12 21:43:42 +00:00
Jan Varga
532a52efb4 Bug 1690025 - Move DirectoryLock class to a separate file; r=dom-storage-reviewers,sg
Differential Revision: https://phabricator.services.mozilla.com/D104154
2021-02-09 10:42:22 +00:00
Butkovits Atila
83658f3247 Backed out 3 changesets (bug 1690025) for causing failure on Client.h. CLOSED TREE
Backed out changeset 5d5e90d31294 (bug 1690025)
Backed out changeset d2b39aebfad2 (bug 1690025)
Backed out changeset 2684aad61a6b (bug 1690025)
2021-02-09 10:12:28 +02:00
Jan Varga
2a4749624a Bug 1690025 - Move DirectoryLock class to a separate file; r=dom-storage-reviewers,sg
Differential Revision: https://phabricator.services.mozilla.com/D104154
2021-02-09 06:52:57 +00:00
Jan Varga
1c79f5169a Bug 1689293 - Introduce DirectoryLock::Acquire; r=sg
Quota clients instead of doing:
RefPtr<DirectoryLock> pendingDirectoryLock = qm->OpenDirectory(..., listener);

now do:
RefPtr<DirectoryLock> directoryLock = qm->CreateDirectoryLock(...);
directoryLock->Acquire(listener);

Differential Revision: https://phabricator.services.mozilla.com/D103279
2021-02-02 08:20:18 +00:00
Simon Giesecke
9204af24f1 Bug 1682536 - Use references/NotNull in Context. r=dom-workers-and-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D99775
2020-12-15 23:25:30 +00:00
Jan Varga
190d6c669b Bug 1680031 - Abort operations for given directory lock ids; r=dom-workers-and-storage-reviewers,sg
This patch changes the way how we abort operations when clearing of data is
requested. Instead of aborting all operations for given origin, we now abort
all operations for given directory locks which are blocking clearing of data.

Differential Revision: https://phabricator.services.mozilla.com/D98609
2020-12-09 08:13:44 +00:00
Simon Giesecke
46908cfb51 Bug 1660470 - Add missing include directives/forward declarations. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D87865
2020-11-23 16:21:38 +00:00
Jan Varga
237fdb68b6 Bug 1619592 - Replace EnsureStorageAndOriginIsInitialized with EnsureTemporaryOriginIsInitialized in dom/cache; r=dom-workers-and-storage-reviewers,sg
Differential Revision: https://phabricator.services.mozilla.com/D97258
2020-11-19 15:41:55 +00:00
Jan Varga
ec3004b8de Bug 1619592 - Remove unused aClientType argument in EnsureStorageAndOriginIsInitialized; r=dom-workers-and-storage-reviewers,sg
Differential Revision: https://phabricator.services.mozilla.com/D97253
2020-11-17 08:37:00 +00:00
Sylvestre Ledru
68b806d604 Bug 1674637 - Use nested namespaces in dom/ r=sg,andi
Also add some missing namespace qualifications

Done with:
./mach static-analysis check --checks="-*,modernize-concat-nested-namespaces" --fix dom/
./mach clang-format -p $(hg status dom/|grep ^M|awk '{print $2}')

Differential Revision: https://phabricator.services.mozilla.com/D95456
2020-11-04 17:04:01 +00:00
Butkovits Atila
a6e7dcc53f Backed out changeset c0adbf7522dc (bug 1674637) for bustage on GMPParent.cpp. CLOSED TREE 2020-11-04 10:54:36 +02:00
Sylvestre Ledru
8f709b39e8 Bug 1674637 - Use nested namespaces in dom/ r=sg,andi
Also add some missing namespace qualifications

Done with:
./mach static-analysis check --checks="-*,modernize-concat-nested-namespaces" --fix dom/
./mach clang-format -p $(hg status dom/|grep ^M|awk '{print $2}')

Differential Revision: https://phabricator.services.mozilla.com/D95456
2020-11-04 08:29:00 +00:00