Commit Graph

821 Commits

Author SHA1 Message Date
Sandor Molnar
a43947a263 Backed out changeset 97190135be72 (bug 1866217) for causing mochitest failures @ test_cache_orphaned_body.html CLOSED TREE 2024-08-16 10:44:43 +03:00
Jan Varga
f30dffcefd Bug 1866217 - Add support for initializing temporary storage to QuotaManager::OpenClientDirectory; r=dom-storage-reviewers,jari
QuotaManager::OpenClientDirectory can now detect the requested persistence type
and initialize temporary storage if it's needed.

Differential Revision: https://phabricator.services.mozilla.com/D195390
2024-08-16 05:56:24 +00:00
Jan Varga
79f4bd0fbf Bug 1866217 - Scope temporary storage initialization to temporary and default repository only; r=dom-storage-reviewers,jari
Temporary storage initialization currently uses a directory lock over all
repositories which blocks any exclusive directory locks for the persistent
repository for no reason.

Differential Revision: https://phabricator.services.mozilla.com/D195389
2024-08-15 05:23:44 +00:00
Jan Varga
6c1c77590e Bug 1866217 - Add support for persistence type sets to PersistenceScope; r=dom-storage-reviewers,jari
Temporary storage initialization can finally lock only specific repositories
instead of locking all repositories (actual temporary storage initialization
locking chagnes will be done in a separate patch).

Differential Revision: https://phabricator.services.mozilla.com/D195374
2024-08-14 20:17:31 +00:00
Jan Varga
d0a8f8f6a6 Bug 1866217 - Replace uses of Nullable<PersistenceType> type with PersistenceScope; r=dom-storage-reviewers,jari
Nullable<PersistenceType> only allows to specify a concrete persistence type or
all persistence types while PersistenceScope is intended to allow specification
of multiple persistence types as well. Support for that will be added in a
separate patch. This patch is about using the new type especially in directory
locks.

Differential Revision: https://phabricator.services.mozilla.com/D195373
2024-08-14 12:46:14 +00:00
Jan Varga
86c2984718 Bug 1866217 - Change nsIQuotaManagerService::GetUsageForPrincipal to support getting origin usage only by inspecting disk; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D195365
2024-08-13 10:40:08 +00:00
Jan Varga
9c64c62ec8 Bug 1866217 - Add a dedicated method for getting cached origin usage; r=dom-storage-reviewers,jari
Cached origin usage can be currently obtained by passing fromMemory=true to
nsIQuotaManagerService::GetUsageForPrincipal. However, supporting both ways of
getting origin on one operation is not ideal for sevaral reasons. The return
value is a plain integer in the case of cached origin usage and getting cached
origin usage in theory doesn't have to go the QM IO thread. So it would be
better to have a dedicated method for that called
nsIQuotaManagerService::GetCachedUsageForPrincipal.

Differential Revision: https://phabricator.services.mozilla.com/D195360
2024-08-12 16:36:38 +00:00
Jan Varga
de73e243ed Bug 1910848 - Rework QuotaManagerService methods for getting usage to use async messages with async responses; r=dom-storage-reviewers,jari
Sub actors are still created, but their only purpose is to allow cancellation
of alreaady created requests. Actual results are now returned as asynchronous
responses to the asynchronous messages.

Differential Revision: https://phabricator.services.mozilla.com/D194097
2024-08-07 07:53:16 +00:00
Jan Varga
88d6c89c01 Bug 1910848 - Move BackgroundThreadObject to separate files; r=dom-storage-reviewers,jari
This will allow to include QuotaCommon.h in header files less often.

Differential Revision: https://phabricator.services.mozilla.com/D194056
2024-08-07 07:53:13 +00:00
Jan Varga
c712045cf2 Bug 1906041 - Add QuotaManager::Initialize(Persistent|Temporary)Origin methods; r=dom-storage-reviewers,jari
There are currently EnsurePersistentOriginIsInitializedInternal and
EnsureTemporaryOriginIsInitializedInternal methods which can only be
called on the QuotaManager IO thread. These methods shouldn't be exposed to
quota clients and origin operations. There should be public methods callable
from the PBackground thread returning a MozPromise instead. Such methods will
guarantee that proper directory locking is acquired before persistent origin
initialization or temporary origin initialization is started.

Differential Revision: https://phabricator.services.mozilla.com/D194005
2024-08-01 09:33:05 +00:00
Kagami Sascha Rosylight
90c218ca5f Bug 1908664 - Add nsIPrincipal::GetIsInPrivateBrowsing r=media-playback-reviewers,anti-tracking-reviewers,dom-storage-reviewers,padenot,asuth,pbz
Differential Revision: https://phabricator.services.mozilla.com/D216993
2024-07-26 17:47:51 +00:00
Jan Varga
0d373bc154 Bug 1906041 - Rename Ensure(Persistent|Temporary)OriginIsInitialized to Ensure(Persistent|Temporary)OriginIsInitializedInternal; r=dom-storage-reviewers,jari
One of the goals of the asynchronous temporary storage initialization is to
call Ensure(Persistent|Temporary)OriginIsInitialized only from
Initialize(Persistent|Temporary)OriginOp. 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/D192150
2024-07-16 10:43:40 +00:00
Jan Varga
0de36a844f Bug 1906041 - Simplify signature of QuotaManager::EnsureTemporaryOriginIsInitialized; r=dom-storage-reviewers,jari
EnsureTemporaryOriginIsInitialized currently takes two separate arguments which
can be expressed as just one argument.

Differential Revision: https://phabricator.services.mozilla.com/D192149
2024-07-16 10:43:39 +00:00
Jan Varga
07bd74474f Bug 1905011 - Replace counting of pending clear/shutdown storage operations with evaluation of existing directory locks; r=dom-storage-reviewers,jari
Counting of clear/shutdown storage operations was only a temporary solution.
We are now approaching a point when we will be able to initialize origins
asynchronously and that can't efficiently work with counting of clear origin
operations because initialization and clearing of origins is parameterized by
persistence type and actual origin. So there can be a clear origin operation
which doesn't block other init origin operation. Couting of clear operations
would be problematic in that case.
Evaluation of existing directory locks should work both for storage and origin
initialization.

Differential Revision: https://phabricator.services.mozilla.com/D193191
2024-07-02 21:40:24 +00:00
Jan Varga
4248cb412f Bug 1905011 - Remove unneeded checks involving mShutdownStorageOpCount; r=hsingh
QuotaManager::InitializeStorage and QuotaManager::InitializeTemporaryStorage
currently check if there are any clear or shutdown storage operations even when
the directory lock has been acquired. There should be no such operations, so
the check can be removed.

Differential Revision: https://phabricator.services.mozilla.com/D192445
2024-07-02 16:49:39 +00:00
Jan Varga
ea2a1a6525 Bug 1905011 - Add optional callbacks to QuotaManager::ShutdownStorage; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D197319
2024-07-02 12:35:22 +00:00
Tom Schuster
feaa0c77a1 Bug 1904004 - Use OriginAttributes::IsPrivateBrowsing instead of open coding PBM checks. r=timhuang,cookie-reviewers,anti-tracking-reviewers,profiler-reviewers,necko-reviewers,kershaw,dom-storage-reviewers,janv,canaltinova,dom-worker-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D214532
2024-06-24 11:06:18 +00:00
Jan Varga
b4890162d2 Bug 1903985 - Add some information about pending ClearRequestBase operations to quota manager shutdown crash annotation; r=dom-storage-reviewers,jstutte
For now, we only report how many directory iterations have been done.

Differential Revision: https://phabricator.services.mozilla.com/D214521
2024-06-21 11:48:01 +00:00
Jan Varga
8e98a0f586 Bug 1888878 - Verify that idle-daily notification triggers maintenance; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D206386
2024-06-20 20:22:05 +00:00
Jan Varga
e87e849e0f Bug 1883353 - Require to always drop directory locks explicitly; r=dom-storage-reviewers,jari
Until now, directory locks were dropped when the last strong reference was
removed or after calling Drop explicitly. The dependency on ref-counting makes
it less obvious when directory locks are dropped for real and it's also
difficult to release them asynchronously eventually. This patch removes the
directory lock unregistration from the destructor, so from now on, directory
locks must be always dropped explicitly.

Differential Revision: https://phabricator.services.mozilla.com/D197294
2024-06-14 07:21:24 +00:00
Jens Stutte
5597a64094 Bug 1889372 - Have the QuotaManagerStorageIsNetworkResource crash annotation on Windows. r=dom-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D206514
2024-04-10 15:47:15 +00:00
Harveer Singh
eb6bf72bfc Bug 1878577: Ensure private storage repo is always cleaned up, even with PBM autostart.r=dom-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D201246
2024-04-05 12:48:51 +00:00
Cristian Tuns
5483a8fc69 Backed out changeset 3a0299d02e89 (bug 1878577) for causing marionette failures in test_registered_service_worker_after_restart CLOSED TREE 2024-04-04 19:17:51 -04:00
Harveer Singh
646b4e9b06 Bug 1878577: Ensure private storage repo is always cleaned up, even with PBM autostart.r=dom-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D201246
2024-04-04 19:59:20 +00:00
Emilio Cobos Álvarez
de09ab0dd6 Bug 1887719 - More consistently use UTF8String/nsCString for URLs. r=necko-reviewers,webidl,anti-tracking-reviewers,places-reviewers,jari,kershaw,janv,smaug,hsivonen
Sorry for the massive patch but I found it hard to split without
introducing a bunch of copies around...

This mostly makes necko and DOM agree on which strings to use, which
should result on less copies and conversions.

Differential Revision: https://phabricator.services.mozilla.com/D205601
2024-04-04 11:49:57 +00:00
abhishekmadan30
35f5bdaf2c Bug 1884941 - Add an option to URLParams::Parse() for if it should decode the parameters or not. r=anti-tracking-reviewers,necko-reviewers,valentin,timhuang.
Differential Revision: https://phabricator.services.mozilla.com/D204914
2024-03-28 18:02:16 +00:00
Iulian Moraru
e6f4355ff3 Backed out 3 changesets (bug 1877419, bug 1884941) for causing non unified build bustages on URLQueryStringStripper.cpp. CLOSED TREE
Backed out changeset 53db0be27620 (bug 1877419)
Backed out changeset b7fab4b145f7 (bug 1877419)
Backed out changeset 78436da20d95 (bug 1884941)
2024-03-26 19:37:45 +02:00
abhishekmadan30
e94987e2b4 Bug 1884941 - Add an option to URLParams::Parse() for if it should decode the parameters or not. r=anti-tracking-reviewers,necko-reviewers,valentin,timhuang.
Differential Revision: https://phabricator.services.mozilla.com/D204914
2024-03-26 14:42:07 +00:00
Noemi Erli
89ffefa292 Backed out 3 changesets (bug 1884941, bug 1877419) for causing bustage in URLQueryStringStripper.cpp CLOSED TREE
Backed out changeset 32c74a4cd05b (bug 1877419)
Backed out changeset c2ca2f596c09 (bug 1877419)
Backed out changeset 45931e6db21e (bug 1884941)
2024-03-25 21:50:27 +02:00
abhishekmadan30
d41edcad79 Bug 1884941 - Add an option to URLParams::Parse() for if it should decode the parameters or not. r=anti-tracking-reviewers,necko-reviewers,valentin,timhuang.
Differential Revision: https://phabricator.services.mozilla.com/D204914
2024-03-25 18:30:38 +00:00
Jan Varga
fdb02cf381 Bug 934640 - Add methods for checking origin and client directory existence; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D191048
2024-03-25 10:54:32 +00:00
Artur Iunusov
7626d7af20 Bug 1770944 - Remove other references to inBrowserElement, r=cookie-reviewers,valentin,janv,decoder
Depends on D183230

Differential Revision: https://phabricator.services.mozilla.com/D189490
2024-03-07 13:04:23 +00:00
Jan Varga
12ca87f8ac Bug 1881526 - Add support for reporting broken origins on disk; r=dom-storage-reviewers,asuth
The extra info is only reported to the system console and browser console, it's
not reported to telemetry.

Differential Revision: https://phabricator.services.mozilla.com/D202439
2024-03-07 06:34:01 +00:00
Jan Varga
87ea60afbf Bug 1881526 - Add tainting support to ScopedLogExtraInfo; r=dom-storage-reviewers,asuth,jari
Any value returned by ScopedLogExtraInfo::GetExtraInfoMap now requires explicit
validation before it can be used. This patch also adjusts LogError to use the
tainting for `extraInfosString` as well which should reduce even more the
chance of accidentally reporting sensitive information.

Differential Revision: https://phabricator.services.mozilla.com/D203355
2024-03-07 06:34:01 +00:00
Cristian Tuns
7295aff223 Backed out 12 changesets (bug 934640) for causing wpt failures in idb-explicit-commit.any.html CLOSED TREE
Backed out changeset f842e5594224 (bug 934640)
Backed out changeset 3cf1e31d16ba (bug 934640)
Backed out changeset ba85838ef7cd (bug 934640)
Backed out changeset a2769ba4c0ab (bug 934640)
Backed out changeset 3a2af6a310ab (bug 934640)
Backed out changeset 8bbe6f8fb695 (bug 934640)
Backed out changeset 184282e69b59 (bug 934640)
Backed out changeset f3b863806999 (bug 934640)
Backed out changeset ed5bb2e976ef (bug 934640)
Backed out changeset f315683fd3ba (bug 934640)
Backed out changeset 30dbc38c3e9a (bug 934640)
Backed out changeset ef90771d141d (bug 934640)
2024-03-05 13:17:12 -05:00
Jan Varga
3367726ec4 Bug 934640 - Add methods for checking origin and client directory existence; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D191048
2024-03-05 13:47:53 +00:00
pstanciu
230e61e928 Backed out 12 changesets (bug 934640) for causing xpcshell failures on test_Store.js. CLOSED TREE
Backed out changeset b9130d0d185f (bug 934640)
Backed out changeset f607e117912b (bug 934640)
Backed out changeset 74b616bdd9ca (bug 934640)
Backed out changeset b4ee14550d3c (bug 934640)
Backed out changeset 133d11049a61 (bug 934640)
Backed out changeset 392886344471 (bug 934640)
Backed out changeset 189686b6ccfa (bug 934640)
Backed out changeset 067b6058bf70 (bug 934640)
Backed out changeset 9b5fbc925fe5 (bug 934640)
Backed out changeset 2e53225b5d81 (bug 934640)
Backed out changeset ffdb716cfa3f (bug 934640)
Backed out changeset fb741c8c2cb6 (bug 934640)
2024-03-05 00:13:09 +02:00
Jan Varga
9f15067f36 Bug 934640 - Add methods for checking origin and client directory existence; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D191048
2024-03-04 17:35:46 +00:00
Gabriele Svelto
e1e9346196 Bug 1831092 - Use the new pull-based API for all crash annotations and remove the global annotations table r=jgilbert,necko-reviewers,media-playback-reviewers,profiler-reviewers,win-reviewers,padenot,handyman,afranchuk,valentin,alwu,sotaro
This changes comes with several different refactorings all rolled into one,
unfotunately I couldn't find a way to pull them apart:
- First of all annotations now can either recorded (that is, we copy the value
  and have the crash reporting code own the copy) or registered. Several
  annotations are changed to use this functionality so that we don't need to
  update them as their value change.
- The code in the exception handler is modified to read the annotations from
  the mozannotation_client crate. This has the unfortunate side-effect that
  we need three different bits of code to serialize them: one for annotations
  read from a child process, one for reading annotations from the main process
  outside of the exception handler and one for reading annotations from the
  main process within the exception handler. As we move to fully
  out-of-process crash reporting the last two methods will go away.
- The mozannotation_client crate now doesn't record annotation types anymore.
  I realized as I was working on this that storing types at runtime has two
  issues: the first one is that buggy code might change the type of an
  annotation (that is record it under two different types at two different
  moments), the second issue is that types might become corrupt during a
  crash, so better enforce them at annotation-writing time. The end result is
  that the mozannotation_* crates now only store byte buffers, track the
  format the data is stored in (null-terminated string, fixed size buffer,
  etc...) but not the type of data each annotation is supposed to contain.
- Which brings us to the next change: concrete types for annotations are now
  enforced when they're written out. If an annotation doesn't match the
  expected type it's skipped. Storing an annotation with the wrong type will
  also trigger an assertion in debug builds.

Differential Revision: https://phabricator.services.mozilla.com/D195248
2024-03-04 10:24:43 +00:00
Jan Varga
b5a406a328 Bug 1855142 - Move IndexedDatabaseManager main thread initialization from FactoryOp::Open to InitializeQuotaManager; r=dom-storage-reviewers,jari
InitializeQuotaManager already initializes the storage service on the main
thread, so the initialization in FactoryOp::Open can be just removed.

Differential Revision: https://phabricator.services.mozilla.com/D189755
2024-02-29 15:28:48 +00:00
Narcis Beleuzu
197b39f007 Backed out 16 changesets (bug 1770944) as req by asuth.
Backed out changeset 61af32f40777 (bug 1770944)
Backed out changeset 4ff0c45db93b (bug 1770944)
Backed out changeset 8a217eff7bcd (bug 1770944)
Backed out changeset 6435f48c96bf (bug 1770944)
Backed out changeset 0d2432765ca0 (bug 1770944)
Backed out changeset 58e02566db85 (bug 1770944)
Backed out changeset 0a8c4c2460ee (bug 1770944)
Backed out changeset 9416bafd9982 (bug 1770944)
Backed out changeset 79de4f83fe2e (bug 1770944)
Backed out changeset 63ac518aceb0 (bug 1770944)
Backed out changeset 14952f872b77 (bug 1770944)
Backed out changeset f65e0967ad75 (bug 1770944)
Backed out changeset bd53c42038f7 (bug 1770944)
Backed out changeset 36c378ba8212 (bug 1770944)
Backed out changeset 9ba54ab06348 (bug 1770944)
Backed out changeset fb5a54b3cbe9 (bug 1770944)
2024-02-23 21:11:08 +02:00
Artur Iunusov
7db9c11413 Bug 1770944 - Remove other references to inBrowserElement, r=cookie-reviewers,valentin,janv,decoder
Depends on D183230

Differential Revision: https://phabricator.services.mozilla.com/D189490
2024-02-22 10:13:15 +00:00
Sandor Molnar
6699491437 Backed out 16 changesets (bug 1770944) for causing asan failures @ dom/base/InProcessBrowserChildMessageManager.cpp
Backed out changeset b73885731e73 (bug 1770944)
Backed out changeset 23d0dc98eb51 (bug 1770944)
Backed out changeset 15661e24d8e1 (bug 1770944)
Backed out changeset 97aa839dc200 (bug 1770944)
Backed out changeset 0d4318bf3239 (bug 1770944)
Backed out changeset be28bb62e9f3 (bug 1770944)
Backed out changeset 708b2671410e (bug 1770944)
Backed out changeset 0a138f3b56b9 (bug 1770944)
Backed out changeset 3a149ef794c2 (bug 1770944)
Backed out changeset 4b6ae7dd0e69 (bug 1770944)
Backed out changeset e3960ad85182 (bug 1770944)
Backed out changeset 9ea253525227 (bug 1770944)
Backed out changeset 1828b66c2f7c (bug 1770944)
Backed out changeset 55b0886f9025 (bug 1770944)
Backed out changeset a4197071d10a (bug 1770944)
Backed out changeset 9b18524f541e (bug 1770944)
2024-02-20 20:34:55 +02:00
Artur Iunusov
c21b2319dc Bug 1770944 - Remove other references to inBrowserElement, r=cookie-reviewers,valentin,janv,decoder
Depends on D183230

Differential Revision: https://phabricator.services.mozilla.com/D189490
2024-02-20 16:53:24 +00:00
Jan Varga
60c524eb90 Bug 1808294 - Add support for directory lock categories; r=dom-storage-reviewers,aiunusov,jari
Differential Revision: https://phabricator.services.mozilla.com/D193105
2024-02-12 10:24:53 +00:00
Jan Varga
1f83681118 Bug 1871799 - Allow calling QuotaManager::GetQuotaObject for unregistered directory locks; r=dom-storage-reviewers,asuth
The method now returns nullptr instead of crashing parent process when there's
no registered directory lock for given directory lock id.
Note that we don't allow arbitrary directory lock ids for unregistered
directory locks, only -1 is allowed.

Differential Revision: https://phabricator.services.mozilla.com/D198187
2024-01-10 21:10:14 +00:00
Jan Varga
a6bbde2554 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
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
Jan Varga
94ed43025b 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
765bbcb374 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