Commit Graph

419 Commits

Author SHA1 Message Date
Jan Varga
b9293292a5 Bug 1591877 - Share the same cached pref value of dom.storage.next_gen across all relevant processes; r=dom-storage-reviewers,jstutte
Differential Revision: https://phabricator.services.mozilla.com/D119711
2021-07-13 11:16:00 +00:00
Jan Varga
ed1318cf0a Bug 1591877 - Forbid creation of PBackgroundLSRequest/PBackgroundLSSimpleRequest actors in the parent process if LSNG is not enabled; r=dom-storage-reviewers,jstutte
Differential Revision: https://phabricator.services.mozilla.com/D119710
2021-07-13 11:16:00 +00:00
Jan Varga
ffa84fb55a Bug 1717990 - LSNG: Convert some NS_ERROR_FAILURE which should have been NS_ERROR_ABORT; r=dom-storage-reviewers,jstutte
Differential Revision: https://phabricator.services.mozilla.com/D118677
2021-06-25 06:27:59 +00:00
Jan Varga
5e3c6d6fc1 Bug 1716570 - LSNG: Add QM_TRY context for PrepareDatastoreOp::DatabaseWork; r=dom-storage-reviewers,jstutte
Differential Revision: https://phabricator.services.mozilla.com/D118673
2021-06-25 02:46:13 +00:00
Jan Varga
88895254bf Bug 1717814 - LSNG: End explicit snapshots while IPC is still available; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D118588
2021-06-23 14:27:51 +00:00
Jan Varga
1bb9cee6b1 Bug 1714284 - LS: Fix building in non-unified builds; r=dom-storage-reviewers,jstutte
Differential Revision: https://phabricator.services.mozilla.com/D116684
2021-06-23 14:19:05 +00:00
Jan Varga
f4a3bc258f Bug 1711848 - Add argument separation comments for QM_OR_ELSE(WARN|NOTE|LOG_VERBOSE)(_IF) uses; r=dom-storage-reviewers,jstutte
Differential Revision: https://phabricator.services.mozilla.com/D115465
2021-06-01 13:58:27 +00:00
Jan Varga
f7d0092e58 Bug 1711656 - Rename QM_OR_ELSE_LOG to QM_OR_ELSE_LOG_VERBOSE; r=dom-storage-reviewers,jstutte
Differential Revision: https://phabricator.services.mozilla.com/D115363
2021-06-01 12:12:27 +00:00
Jan Varga
0859779a45 Bug 1708643 - LS: Replace QM_OR_ELSE_(WARN|LOG) with QM_OR_ELSE_(WARN|LOG)_IF in places where the fallback needs to be called conditionally; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D115153
2021-05-30 11:08:03 +00:00
Jens Stutte
61d67b9ff0 Bug 1706998: Replace QuotaManager::GetRef().MaybeRecordShutdownStep by static QuotaManager::(Safe)MaybeRecordQuotaClientShutdownStep; r=dom-storage-reviewers,janv
There are some few unsafe uses of MaybeRecordShutdownStep where the QuotaManager singleton may be  not (yet or anymore) alive.
In order to not add many unnecessary null checks, we drop GetRef and MaybeRecordShutdownStep in favor of
QuotaManager::MaybeRecordQuotaClientShutdownStep
QuotaManager::SafeMaybeRecordQuotaClientShutdownStep
with the sole difference that the Safe variant runtime checks the singleton, while the normal one only asserts.

Differential Revision: https://phabricator.services.mozilla.com/D115988
2021-05-28 06:46:04 +00:00
Jan Varga
e016ebac70 Bug 1711181 - Add explanatory comments for some special uses of QM_OR_ELSE_WARN; r=dom-storage-reviewers,jstutte
Differential Revision: https://phabricator.services.mozilla.com/D115160
2021-05-21 09:30:30 +00:00
Jan Varga
52086b9801 Bug 1711181 - Change uses of ordinary orElse to QM_OR_ELSE_LOG; r=dom-storage-reviewers,jstutte
This is more consistent with other cases where we either use QM_OR_ELSE_WARN or
QM_OR_ELSE_NOTE. We will later change some uses of QM_OR_ELSE_LOG to
QM_OR_ELSE_LOG_IF. The switch from custom OrElseIf to Result::orElseIf will be
easier when we don't use OrElseIf directly.

This patch only changes uses of ordinary orElse introduced in bug 1701346.

Remaining uses will be handled in bug 1711180 (the ones that were missed in bug
1686191).

Differential Revision: https://phabricator.services.mozilla.com/D115055
2021-05-21 09:30:30 +00:00
Jan Varga
cd7cdb6548 Bug 1710646 - LSNG: UpdateUsageFile should flush the stream before closing it; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D114858
2021-05-12 03:02:23 +00:00
Jan Varga
5facda493a Bug 1709067 - LS: Remove module specific QM_TRY macros; r=dom-storage-reviewers,jstutte
Depends on D114082

Differential Revision: https://phabricator.services.mozilla.com/D114083
2021-05-03 19:44:40 +00:00
Jan Varga
604404dd23 Bug 1706350 - Follow-up cleanup for bug 1648399; r=dom-storage-reviewers,asuth
This patch addresses remaining review comments from
https://phabricator.services.mozilla.com/D81680.
It also adds missing origin initialization to the tests which was causing
unnecessary warnings during test execution.

Differential Revision: https://phabricator.services.mozilla.com/D112759
2021-04-21 13:55:04 +00:00
Jan Varga
e981a6fd53 Bug 1703310 - Enable LocalStorage NextGen (LSNG) when "network.cookie.lifetimePolicy" is set to ACCEPT_SESSION (2); r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D112326
2021-04-17 03:20:17 +00:00
Tom Tung
f2aee4b5a8 Bug 1648399 - Add test cases to ensure that a cache/ls directory in permanent origin directory shouldn't cause storage init to fail; r=dom-workers-and-storage-reviewers,sg,janv
Depends on D80824

Differential Revision: https://phabricator.services.mozilla.com/D81680
2021-04-16 01:09:10 +00:00
Jan Varga
4913acef81 Bug 1701346 - LSNG: Revert QM_OR_ELSE_WARN to ordinary orElse in ExistsAsFile; r=asuth,dom-storage-reviewers,jstutte
Depends on D109991

Differential Revision: https://phabricator.services.mozilla.com/D109992
2021-03-27 13:08:07 +00:00
Simon Giesecke
cc730d05dd Bug 1184468 - Use nsTHashtable::Keys where possible. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D108588
2021-03-24 17:56:50 +00:00
Simon Giesecke
613e20d136 Bug 1184468 - Use nsBaseHashtable::Values. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D108587
2021-03-24 17:56:49 +00:00
Jan Varga
7d3ef83b0f Bug 1686191 - Have a way to specifically report warnings around QM_TRY; r=asuth,sg,dom-storage-reviewers
This patch:
- adds QM_WARNONLY_TRY/QM_NOTEONLY_TRY macros
- adds QM_WARNONLY_TRY_UNWRAP/QM_NOTEONLY_TRY_UNWRAP macros
- adds QM_OR_ELSE_WARN/QM_OR_ELSE_NOTE sub macros
- replaces non-propagating uses of NS_WARNING with redundant messages by
  QM_WARNONLY_TRY
- replaces uses of QM_TRY with orElse by QM_TRY(QM_OR_ELSE_WARN(...))
- replaces uses of QM_TRY inside an extra lambda with QM_WARNONLY_TRY
- replaces uses of QM_TRY with QM_VOID with QM_WARNONLY_TRY.
- replaces uses of QM_TRY with unwanted warnings with QM_NOTEONLY_TRY
- replaces uses of QM_TRY with additional Maybe wrapping for doing a
  fallback with QM_TRY(QM_OR_ELSE_WARN(...))

Differential Revision: https://phabricator.services.mozilla.com/D108424
2021-03-24 12:27:53 +00:00
Butkovits Atila
9fc0210ad3 Backed out changeset 2a3316bd2409 (bug 1686191) for causing bustages on QuotaCommon.h. CLOSED TREE 2021-03-24 07:12:55 +02:00
Jan Varga
6edcf204fd Bug 1686191 - Have a way to specifically report warnings around QM_TRY; r=asuth,sg,dom-storage-reviewers
This patch:
- adds QM_WARNONLY_TRY/QM_NOTEONLY_TRY macros
- adds QM_WARNONLY_TRY_UNWRAP/QM_NOTEONLY_TRY_UNWRAP macros
- adds QM_OR_ELSE_WARN/QM_OR_ELSE_NOTE sub macros
- replaces non-propagating uses of NS_WARNING with redundant messages by
  QM_WARNONLY_TRY
- replaces uses of QM_TRY with orElse by QM_TRY(QM_OR_ELSE_WARN(...))
- replaces uses of QM_TRY inside an extra lambda with QM_WARNONLY_TRY
- replaces uses of QM_TRY with QM_VOID with QM_WARNONLY_TRY.
- replaces uses of QM_TRY with unwanted warnings with QM_NOTEONLY_TRY
- replaces uses of QM_TRY with additional Maybe wrapping for doing a
  fallback with QM_TRY(QM_OR_ELSE_WARN(...))

Differential Revision: https://phabricator.services.mozilla.com/D108424
2021-03-24 04:40:10 +00:00
Simon Giesecke
11949c7259 Bug 708901 - Migrate to nsTHashSet in dom/localstorage. r=dom-storage-reviewers,janv
Depends on D108598

Differential Revision: https://phabricator.services.mozilla.com/D108599
2021-03-23 10:36:34 +00:00
Jan Varga
c546aae9a0 Bug 1697115 - Rationalize QuotaManager::ResetUsageForClient arguments; r=dom-storage-reviewers,sg
Differential Revision: https://phabricator.services.mozilla.com/D107616
2021-03-17 06:56:39 +00:00
Jan Varga
b59182de8d Bug 1697115 - Rationalize QuotaManager::DecreaseUsageForClient arguments; r=dom-storage-reviewers,sg
Note that the method DecreaseUsageForOrigin has been renamed to
DecreaseUsageForClient.

Differential Revision: https://phabricator.services.mozilla.com/D107615
2021-03-17 06:56:39 +00:00
Jan Varga
ebce7d3ac8 Bug 1697115 - Rationalize QuotaManager::EnsureQuotaForOrigin arguments; r=dom-storage-reviewers,sg
Differential Revision: https://phabricator.services.mozilla.com/D107612
2021-03-17 06:56:38 +00:00
Simon Giesecke
91fdeec18c Bug 1695162 - Migrate from custom hashtable iteration to range-based for in accessible, dom/animation, dom/base, dom/localstorage, gfx/thebes. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D106895
2021-03-12 16:14:58 +00:00
Alexandru Michis
c691800cb0 Backed out changeset fd03162e726d (bug 1695162) for causing bustages in Document.cpp
CLOSED TREE
2021-03-12 17:10:02 +02:00
Simon Giesecke
fbf7a1dad4 Bug 1686191 - Remove module argument from LogError. r=dom-workers-and-storage-reviewers,janv
The module argument in LogError is redundant: the module information can
already be determined from the source file path. Indeed, reporting the module
separately in the telemetry events seems unnecessary. Instead, the relative
path is now reported. This is what the analysis of the telemetry data did
reconstruct anyway.

As a consequence, it's no longer necessary to define module-specific
HandleError functions, and therefore it's also unnecessary to define
module-specific TRY macros. These are retained as simple aliases for now,
but can be removed in a later patch entirely.

This also avoids misuses of a TRY macros in the wrong module, which were
happening a few times before, resulting in confusing output or telemetry
events.

Since Bug 1686191 will add some more TRY macro variants that warn, so
simplifying the module-specific aspects will simplify that task. Furthermore,
this is in preparation of moving the TRY macro extensions to MFBT.

Differential Revision: https://phabricator.services.mozilla.com/D102767
2021-03-12 15:01:21 +00:00
Simon Giesecke
2fb6095f16 Bug 1695162 - Migrate from custom hashtable iteration to range-based for in accessible, dom/animation, dom/base, dom/localstorage, gfx/thebes. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D106895
2021-03-12 14:54:08 +00:00
Simon Giesecke
77de1d90be Bug 1634281 - Use (STL) algorithms instead of custom hashtable iteration where possible in dom/localstorage. r=dom-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D107679
2021-03-10 13:10:37 +00:00
Simon Giesecke
ad01a10a3b Bug 1634281 - Use nsTHashMap instead of nsDataHashtable. r=xpcom-reviewers,necko-reviewers,jgilbert,nika,valentin
Note that this patch only transforms the use of the nsDataHashtable type alias
to a directly equivalent use of nsTHashMap. It does not change the specification
of the hash key type to make use of the key class deduction that nsTHashMap
allows for in some cases. That can be done in a separate step, but requires more
attention.

Differential Revision: https://phabricator.services.mozilla.com/D106008
2021-03-10 10:47:47 +00:00
Jan Varga
52647a0d1e 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
eeb8cf2781 Bug 1695883 - Add explicit fallible mozStorageTransaction::Start method for starting the transaction; r=dom-storage-reviewers,sg
The new method is mandatory because mozStorageTransaction constructor no longer
starts the transaction. It must be started explicitely.

All consumers have been adjusted, but only dom/quota, dom/indexedDB, dom/cache,
dom/localstorage and dom/storage handle the error. Other components like
netwerk/cache, netwerk/cookie and toolkit/components currently only warn on
failure to start a transaction. Bug 1696129, 1696130 and 1696133 have been
filed for proper handling of transaction start failures in those components.

Differential Revision: https://phabricator.services.mozilla.com/D106893
2021-03-04 04:38:06 +00:00
Simon Giesecke
0b97035410 Bug 1693541 - Improve uses of nsBaseHashtable and descendants and avoid multiple subsequent lookups in dom/localstorage. r=dom-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D106089
2021-03-01 09:59:31 +00:00
Simon Giesecke
b399a8194c Bug 1691913 - Add some convenience methods to LookupResult and EntryHandle. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D105475
2021-03-01 09:59:29 +00:00
Simon Giesecke
0b443059fd Bug 1693306 - Simplify some uses of LookupOrInsertWith by GetOrInsertNew. r=xpcom-reviewers,necko-reviewers,dragana,nika
Differential Revision: https://phabricator.services.mozilla.com/D105479
2021-02-26 09:22:54 +00:00
Simon Giesecke
9af107a839 Bug 1691913 - Rename nsBaseHashtable::Put to InsertOrUpdate. r=xpcom-reviewers,necko-reviewers,jgilbert,dragana,nika
This makes the naming more consistent with other functions called
Insert and/or Update. Also, it removes the ambiguity whether
Put expects that an entry already exists or not, in particular because
it differed from nsTHashtable::PutEntry in that regard.

Differential Revision: https://phabricator.services.mozilla.com/D105473
2021-02-26 09:11:46 +00:00
Simon Giesecke
4f75368dcb Bug 1691913 - Rename nsBaseHashtable::GetOrInsert(With) to LookupOrInsert(With). r=xpcom-reviewers,necko-reviewers,jgilbert,dragana,nika
The functions should be called "Lookup" rather than "Get" because they return
a DataType& (rather than UserDataType).

Differential Revision: https://phabricator.services.mozilla.com/D105472
2021-02-26 09:11:45 +00:00
Simon Giesecke
d2caea36fa Bug 1691894 - Simplify uses of WithEntryHandle that only use OrInsert(With) by using GetOrInsertWith. r=xpcom-reviewers,necko-reviewers,jgilbert,nika
Differential Revision: https://phabricator.services.mozilla.com/D104676
2021-02-22 12:07:46 +00:00
Simon Giesecke
e740cbc60f Bug 1689680 - Do fallback from existing archive file to webapps store file to empty file more consistently. r=dom-storage-reviewers,ttung
Includes an amendment by janv.

Differential Revision: https://phabricator.services.mozilla.com/D105032
2021-02-17 16:41:08 +00:00
Simon Giesecke
661e25bf09 Bug 1692880 - Make Put accept DataType instead of wrapping UserDataType. r=xpcom-reviewers,necko-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D104850
2021-02-16 15:53:33 +00:00
Simon Giesecke
767b2bb664 Bug 1689680 - Add StorageDBUpdater::CreateCurrentSchema and call that if we know we have a fresh database file. r=dom-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D104716
2021-02-16 08:55:15 +00:00
Simon Giesecke
780a1636a9 Bug 1691894 - Replace several suboptimal uses of Put after Get by GetOrInsertWith or WithEntryHandle. r=xpcom-reviewers,necko-reviewers,kmag,valentin,geckoview-reviewers,agi
Differential Revision: https://phabricator.services.mozilla.com/D104849
2021-02-15 15:12:17 +00:00
smolnar
1afbbe67e1 Backed out 5 changesets (bug 1691894) for causing hazard failures in nsXULPrototypeCache. CLOSED TREE
Backed out changeset 22dc870ee609 (bug 1691894)
Backed out changeset 58c31e9d6ae3 (bug 1691894)
Backed out changeset 7483e84149d8 (bug 1691894)
Backed out changeset f977d6cfa973 (bug 1691894)
Backed out changeset db4503476f34 (bug 1691894)
2021-02-15 16:43:23 +02:00
Simon Giesecke
3c29a68440 Bug 1691894 - Make Put accept DataType instead of wrapping UserDataType. r=xpcom-reviewers,necko-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D104850
2021-02-15 10:04:46 +00:00
Simon Giesecke
8973094ec1 Bug 1691894 - Replace several suboptimal uses of Put after Get by GetOrInsertWith or WithEntryHandle. r=xpcom-reviewers,necko-reviewers,kmag,valentin,geckoview-reviewers,agi
Differential Revision: https://phabricator.services.mozilla.com/D104849
2021-02-15 10:04:45 +00:00
Jan Varga
832c277718 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
4323e6df02 Bug 1686031 - Rename GroupAndOrigin to OriginMetadata; r=dom-storage-reviewers,sg
Differential Revision: https://phabricator.services.mozilla.com/D104970
2021-02-12 14:03:28 +00:00