Граф коммитов

596 Коммитов

Автор SHA1 Сообщение Дата
Tom Ritter b3eebfc6a7 Bug 1766866: Restricting other preferences we don't want in the content process r=bholley
This list contains items that contain actual user data like
their device name or their downloads path, items that contain
UUIDs that could be used to track users across different
origins, sessions, or private browsing, and values that
either change occassionally or don't have enough entropy to
serve as a long-lived UUID, but do have enough entropy to be
used as a short-term correlatable identified to e.g.
de-anonymize someone use the VPN feature of containers.

Depends on D145259

Differential Revision: https://phabricator.services.mozilla.com/D145260
2022-05-03 13:42:57 +00:00
Tom Ritter 323263f1e3 Bug 1766866: Improve assertions for Static Preferences r=KrisWright
During testing I started hitting these cases that were not
well-documented for the person hitting the crash, so let's
improve them.

Differential Revision: https://phabricator.services.mozilla.com/D145259
2022-05-03 13:42:57 +00:00
Tom Ritter c956bb1a40 Bug 1752332: Suppress Hazard warnings due to hash table function pointers r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D144437
2022-04-27 12:57:40 +00:00
Tom Ritter 0e86156db0 Bug 1752332: Sanitize preferences in the shared memory region r=KrisWright
Before we would stick all prefs into an immutable shared memory
region and clear our HashMap.

Now we will stick all non-sanitized prefs into the immutable
shared memory region, save the sanitized prefs in a list
temporarily, clear the hashmap, and then repopulate the hashmap
with the sanitized prefs.

As a bit of underlying complexity, to do this we must do some
tricks with the Pref Name Arena which is a chunk of memory
dedicated to storing pref names. That goes away (and we want to
wipe it to save space) - so we just need to move the sanitized
pref names to a new arena.

Depends on D141421

Differential Revision: https://phabricator.services.mozilla.com/D141422
2022-04-27 12:57:39 +00:00
Tom Ritter f0eebfe778 Bug 1752332: Optimize the crash checks in Check*Value functions r=KrisWright
We busted browser_preferences_usage.js by looking up a
preference too many times.

The reason we are now exceeding the pref-reading limit for
this pref is that inside ShouldSanitizePreference all of
our calls to Preferences::Something(pref_name) are causing
pref lookups.  _Most_ of the time when we are in
ShouldSanitizePreference, we got there from a place that has
the actual pref object; so change the function to take in a
Pref object.

Unfortunately, there is a place we do need to look it up
by name, and that's in Static Pref getters, so we need to
keep that function around (and expose it in Preferences.h)

To minimize code duplication (i.e. not having the exact same
code for ShouldSanitizePreference(Pref) and
ShouldSanitizePreference(PrefWrapper) we do some templating
tricks because even though they expose the same API, they are
not in a class hierarchy where we could just make one function
for a base class.

Depends on D141420

Differential Revision: https://phabricator.services.mozilla.com/D141421
2022-04-27 12:57:39 +00:00
Tom Ritter 41f8e427e9 Bug 1752332: Remove the shouldSanitizeFunction member r=KrisWright
In the following patch we are going to change the signature of
ShouldSanitizePreference to take a Pref object.  Pref is only
known to the Preferences compilation unit; so to keep this member
(whose signature will change) we would need to expose the Pref
class. However it will only be a forward declaration, one could
not construct a Pref object in e.g. the gtest.

It is simpler to just remove the member entirely and call
ShouldSanitizePreference unconditionally - the member was only
used for the gtest, and while the gtest will be less robust
because of this change, it will still do some testing.

Depends on D141419

Differential Revision: https://phabricator.services.mozilla.com/D141420
2022-04-27 12:57:38 +00:00
Tom Ritter 2288ff8472 Bug 1752332: Add preferences that control whether we send user data and/or crash r=KrisWright
Depends on D141418

Differential Revision: https://phabricator.services.mozilla.com/D141419
2022-04-27 12:57:38 +00:00
Tom Ritter 4e42effc79 Bug 1752332: Crash if a pref is accessed that shouldn't be r=KrisWright
Depends on D141417

Differential Revision: https://phabricator.services.mozilla.com/D141418
2022-04-27 12:57:37 +00:00
Tom Ritter 617ae2d037 Bug 1752332: Improve the blocklisting behavior r=KrisWright
For all subprocesses, if a preference is in the blocklist,
sanitize it.  (This preserves the IPC optimization behavior,
kind of.  We now generate IPC traffic when we didn't before,
but we omit the value. Values were previously capped at 4 KiB
now they're 0 bytes.)

For Web Content processes, we sanitize a preference if it is
in the blocklist, or if does not have a Default value (i.e.
it is dynamically named). There is an exception list for
dynamically named preferences we know we need though.

In subprocesses, we know if a preference was sanitized
by checking its Sanitized bit.

Depends on D141416

Differential Revision: https://phabricator.services.mozilla.com/D141417
2022-04-27 12:57:37 +00:00
Tom Ritter cf5cc35a2d Bug 1752332: Make SerializePreferences correctly sanitize preferences r=KrisWright,necko-reviewers,dragana
To do the correct thing in Preferences::SerializePreferences
(which is used during subprocess startup) we need to know if
the destination process is a web content process or not.
We add parameters to
SharedPreferenceSerializer::SerializeToSharedMemory that let
us figure that out.

In Preferences::SerializePreferences we fix the call to
aShouldSanitizeFn to pass the correct destination.

Depends on D141415

Differential Revision: https://phabricator.services.mozilla.com/D141416
2022-04-27 12:57:37 +00:00
Tom Ritter 8fd70bf701 Bug 1752332: Remove some prefs from the blocklist r=KrisWright
Depends on D141413

Differential Revision: https://phabricator.services.mozilla.com/D141414
2022-04-27 12:57:36 +00:00
Tom Ritter ea3a8f9f97 Bug 1752332: Correctly populate the sanitized bit for PreferenceUpdate r=KrisWright
PreferenceUpdate is the IPC message notifying a child process
that a preference has been updated. To correctly decide whether
or not a value should be sanitized in it, we need to know
what type of destination process it is; we add parameters to
Preferences::GetPreference indicating that.

Inside of ToDomPref we call ShouldSanitizePreference to
correctly populate the sanitized bit.

Depends on D141412

Differential Revision: https://phabricator.services.mozilla.com/D141413
2022-04-27 12:57:36 +00:00
Tom Ritter ce8ed8e849 Bug 1752332: Rename ShouldSyncPreference to ShouldSanitizePreference r=KrisWright
This simplifies the number of negations needed,
and makes things easy to understand. I think
anyway; I know that without renaming it I made
several annoying-to-diagnose negation errors...

Depends on D141411

Differential Revision: https://phabricator.services.mozilla.com/D141412
2022-04-27 12:57:35 +00:00
Tom Ritter dae964f1a8 Bug 1752332: Tell ShouldSyncPreference if the destination is a web content process r=KrisWright
A couple places where it might be a web content process
still pass 'false' - this will be corrected in a later
patch.

Depends on D141410

Differential Revision: https://phabricator.services.mozilla.com/D141411
2022-04-27 12:57:35 +00:00
Tom Ritter 32adae1779 Bug 1752332: Move ShouldSyncPreferences to Preferences module r=KrisWright
Depends on D141409

Differential Revision: https://phabricator.services.mozilla.com/D141410
2022-04-27 12:57:34 +00:00
Tom Ritter 1e49cf60d8 Bug 1752332: Add a sanitized property to prefs r=KrisWright
Differential Revision: https://phabricator.services.mozilla.com/D141408
2022-04-27 12:57:34 +00:00
Butkovits Atila c891bf41e7 Backed out 17 changesets (bug 1752332) for causing crashes at JS::AutoAssertNoGC::AutoAssertNoGC(JSContext*). CLOSED TREE
Backed out changeset eaa4213b9e08 (bug 1752332)
Backed out changeset 2d794b61fbf7 (bug 1752332)
Backed out changeset 69cbec3e9a11 (bug 1752332)
Backed out changeset 022a68e8d603 (bug 1752332)
Backed out changeset 1ff8656b362d (bug 1752332)
Backed out changeset 46ea5b4f9ad3 (bug 1752332)
Backed out changeset e1dcb4c7cb88 (bug 1752332)
Backed out changeset f9d6bc72406f (bug 1752332)
Backed out changeset dd02b8ef0219 (bug 1752332)
Backed out changeset 3e60b77153a3 (bug 1752332)
Backed out changeset ce93b08837d2 (bug 1752332)
Backed out changeset d165042105ea (bug 1752332)
Backed out changeset 22b910308ecd (bug 1752332)
Backed out changeset d2e748ccd01c (bug 1752332)
Backed out changeset a89203990075 (bug 1752332)
Backed out changeset b580c2a3bac0 (bug 1752332)
Backed out changeset a2d5880b528f (bug 1752332)
2022-04-25 17:55:17 +03:00
Tom Ritter 7a53777411 Bug 1752332: Suppress Hazard warnings due to hash table function pointers r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D144437
2022-04-25 13:54:05 +00:00
Tom Ritter 9a95903aa5 Bug 1752332: Sanitize preferences in the shared memory region r=KrisWright
Before we would stick all prefs into an immutable shared memory
region and clear our HashMap.

Now we will stick all non-sanitized prefs into the immutable
shared memory region, save the sanitized prefs in a list
temporarily, clear the hashmap, and then repopulate the hashmap
with the sanitized prefs.

As a bit of underlying complexity, to do this we must do some
tricks with the Pref Name Arena which is a chunk of memory
dedicated to storing pref names. That goes away (and we want to
wipe it to save space) - so we just need to move the sanitized
pref names to a new arena.

Depends on D141421

Differential Revision: https://phabricator.services.mozilla.com/D141422
2022-04-25 13:54:04 +00:00
Tom Ritter 1cacb9fc02 Bug 1752332: Optimize the crash checks in Check*Value functions r=KrisWright
We busted browser_preferences_usage.js by looking up a
preference too many times.

The reason we are now exceeding the pref-reading limit for
this pref is that inside ShouldSanitizePreference all of
our calls to Preferences::Something(pref_name) are causing
pref lookups.  _Most_ of the time when we are in
ShouldSanitizePreference, we got there from a place that has
the actual pref object; so change the function to take in a
Pref object.

Unfortunately, there is a place we do need to look it up
by name, and that's in Static Pref getters, so we need to
keep that function around (and expose it in Preferences.h)

To minimize code duplication (i.e. not having the exact same
code for ShouldSanitizePreference(Pref) and
ShouldSanitizePreference(PrefWrapper) we do some templating
tricks because even though they expose the same API, they are
not in a class hierarchy where we could just make one function
for a base class.

Depends on D141420

Differential Revision: https://phabricator.services.mozilla.com/D141421
2022-04-25 13:54:04 +00:00
Tom Ritter dbac0fccf2 Bug 1752332: Remove the shouldSanitizeFunction member r=KrisWright
In the following patch we are going to change the signature of
ShouldSanitizePreference to take a Pref object.  Pref is only
known to the Preferences compilation unit; so to keep this member
(whose signature will change) we would need to expose the Pref
class. However it will only be a forward declaration, one could
not construct a Pref object in e.g. the gtest.

It is simpler to just remove the member entirely and call
ShouldSanitizePreference unconditionally - the member was only
used for the gtest, and while the gtest will be less robust
because of this change, it will still do some testing.

Depends on D141419

Differential Revision: https://phabricator.services.mozilla.com/D141420
2022-04-25 13:54:03 +00:00
Tom Ritter 297cd05828 Bug 1752332: Add preferences that control whether we send user data and/or crash r=KrisWright
Depends on D141418

Differential Revision: https://phabricator.services.mozilla.com/D141419
2022-04-25 13:54:03 +00:00
Tom Ritter 0251e1437c Bug 1752332: Crash if a pref is accessed that shouldn't be r=KrisWright
Depends on D141417

Differential Revision: https://phabricator.services.mozilla.com/D141418
2022-04-25 13:54:03 +00:00
Tom Ritter 904aadd877 Bug 1752332: Improve the blocklisting behavior r=KrisWright
For all subprocesses, if a preference is in the blocklist,
sanitize it.  (This preserves the IPC optimization behavior,
kind of.  We now generate IPC traffic when we didn't before,
but we omit the value. Values were previously capped at 4 KiB
now they're 0 bytes.)

For Web Content processes, we sanitize a preference if it is
in the blocklist, or if does not have a Default value (i.e.
it is dynamically named). There is an exception list for
dynamically named preferences we know we need though.

In subprocesses, we know if a preference was sanitized
by checking its Sanitized bit.

Depends on D141416

Differential Revision: https://phabricator.services.mozilla.com/D141417
2022-04-25 13:54:02 +00:00
Tom Ritter 90b65f0b6f Bug 1752332: Make SerializePreferences correctly sanitize preferences r=KrisWright,necko-reviewers,dragana
To do the correct thing in Preferences::SerializePreferences
(which is used during subprocess startup) we need to know if
the destination process is a web content process or not.
We add parameters to
SharedPreferenceSerializer::SerializeToSharedMemory that let
us figure that out.

In Preferences::SerializePreferences we fix the call to
aShouldSanitizeFn to pass the correct destination.

Depends on D141415

Differential Revision: https://phabricator.services.mozilla.com/D141416
2022-04-25 13:54:02 +00:00
Tom Ritter eda46349a8 Bug 1752332: Remove some prefs from the blocklist r=KrisWright
Depends on D141413

Differential Revision: https://phabricator.services.mozilla.com/D141414
2022-04-25 13:54:01 +00:00
Tom Ritter f9201a6b3f Bug 1752332: Correctly populate the sanitized bit for PreferenceUpdate r=KrisWright
PreferenceUpdate is the IPC message notifying a child process
that a preference has been updated. To correctly decide whether
or not a value should be sanitized in it, we need to know
what type of destination process it is; we add parameters to
Preferences::GetPreference indicating that.

Inside of ToDomPref we call ShouldSanitizePreference to
correctly populate the sanitized bit.

Depends on D141412

Differential Revision: https://phabricator.services.mozilla.com/D141413
2022-04-25 13:54:01 +00:00
Tom Ritter e7d695f54c Bug 1752332: Rename ShouldSyncPreference to ShouldSanitizePreference r=KrisWright
This simplifies the number of negations needed,
and makes things easy to understand. I think
anyway; I know that without renaming it I made
several annoying-to-diagnose negation errors...

Depends on D141411

Differential Revision: https://phabricator.services.mozilla.com/D141412
2022-04-25 13:54:00 +00:00
Tom Ritter ef6d930532 Bug 1752332: Tell ShouldSyncPreference if the destination is a web content process r=KrisWright
A couple places where it might be a web content process
still pass 'false' - this will be corrected in a later
patch.

Depends on D141410

Differential Revision: https://phabricator.services.mozilla.com/D141411
2022-04-25 13:54:00 +00:00
Tom Ritter 4ef13ee7f8 Bug 1752332: Move ShouldSyncPreferences to Preferences module r=KrisWright
Depends on D141409

Differential Revision: https://phabricator.services.mozilla.com/D141410
2022-04-25 13:53:59 +00:00
Tom Ritter ef57c7df72 Bug 1752332: Add a sanitized property to prefs r=KrisWright
Differential Revision: https://phabricator.services.mozilla.com/D141408
2022-04-25 13:53:59 +00:00
Cristian Tuns 467d2abfd0 Backed out 16 changesets (bug 1752332) for causing gtest failures CLOSED TREE
Backed out changeset 2523f5463789 (bug 1752332)
Backed out changeset 8d2932869cbd (bug 1752332)
Backed out changeset 7d159898e81d (bug 1752332)
Backed out changeset 5b9bbe252fec (bug 1752332)
Backed out changeset aeb79413e987 (bug 1752332)
Backed out changeset c184c517de91 (bug 1752332)
Backed out changeset 1bc4f1780f37 (bug 1752332)
Backed out changeset 2b78f295d903 (bug 1752332)
Backed out changeset 21f015b60220 (bug 1752332)
Backed out changeset a74095dfe3da (bug 1752332)
Backed out changeset 4b04bf33486e (bug 1752332)
Backed out changeset 8566711743a8 (bug 1752332)
Backed out changeset eec507d87b2b (bug 1752332)
Backed out changeset ef50d2618c7f (bug 1752332)
Backed out changeset 1b4d316e7f20 (bug 1752332)
Backed out changeset e40a778cb93f (bug 1752332)
2022-04-20 17:23:11 -04:00
Tom Ritter c781409d77 Bug 1752332: Sanitize preferences in the shared memory region r=KrisWright
Before we would stick all prefs into an immutable shared memory
region and clear our HashMap.

Now we will stick all non-sanitized prefs into the immutable
shared memory region, save the sanitized prefs in a list
temporarily, clear the hashmap, and then repopulate the hashmap
with the sanitized prefs.

As a bit of underlying complexity, to do this we must do some
tricks with the Pref Name Arena which is a chunk of memory
dedicated to storing pref names. That goes away (and we want to
wipe it to save space) - so we just need to move the sanitized
pref names to a new arena.

Depends on D141421

Differential Revision: https://phabricator.services.mozilla.com/D141422
2022-04-20 20:21:48 +00:00
Tom Ritter 2787efa727 Bug 1752332: Optimize the crash checks in Check*Value functions r=KrisWright
We busted browser_preferences_usage.js by looking up a
preference too many times.

The reason we are now exceeding the pref-reading limit for
this pref is that inside ShouldSanitizePreference all of
our calls to Preferences::Something(pref_name) are causing
pref lookups.  _Most_ of the time when we are in
ShouldSanitizePreference, we got there from a place that has
the actual pref object; so change the function to take in a
Pref object.

Unfortunately, there is a place we do need to look it up
by name, and that's in Static Pref getters, so we need to
keep that function around (and expose it in Preferences.h)

To minimize code duplication (i.e. not having the exact same
code for ShouldSanitizePreference(Pref) and
ShouldSanitizePreference(PrefWrapper) we do some templating
tricks because even though they expose the same API, they are
not in a class hierarchy where we could just make one function
for a base class.

Depends on D141420

Differential Revision: https://phabricator.services.mozilla.com/D141421
2022-04-20 20:21:48 +00:00
Tom Ritter 3313c98eaf Bug 1752332: Remove the shouldSanitizeFunction member r=KrisWright
In the following patch we are going to change the signature of
ShouldSanitizePreference to take a Pref object.  Pref is only
known to the Preferences compilation unit; so to keep this member
(whose signature will change) we would need to expose the Pref
class. However it will only be a forward declaration, one could
not construct a Pref object in e.g. the gtest.

It is simpler to just remove the member entirely and call
ShouldSanitizePreference unconditionally - the member was only
used for the gtest, and while the gtest will be less robust
because of this change, it will still do some testing.

Depends on D141419

Differential Revision: https://phabricator.services.mozilla.com/D141420
2022-04-20 20:21:47 +00:00
Tom Ritter 59092e70b4 Bug 1752332: Add preferences that control whether we send user data and/or crash r=KrisWright
Depends on D141418

Differential Revision: https://phabricator.services.mozilla.com/D141419
2022-04-20 20:21:47 +00:00
Tom Ritter 9b9b78005e Bug 1752332: Crash if a pref is accessed that shouldn't be r=KrisWright
Depends on D141417

Differential Revision: https://phabricator.services.mozilla.com/D141418
2022-04-20 20:21:47 +00:00
Tom Ritter 0268186690 Bug 1752332: Improve the blocklisting behavior r=KrisWright
For all subprocesses, if a preference is in the blocklist,
sanitize it.  (This preserves the IPC optimization behavior,
kind of.  We now generate IPC traffic when we didn't before,
but we omit the value. Values were previously capped at 4 KiB
now they're 0 bytes.)

For Web Content processes, we sanitize a preference if it is
in the blocklist, or if does not have a Default value (i.e.
it is dynamically named). There is an exception list for
dynamically named preferences we know we need though.

In subprocesses, we know if a preference was sanitized
by checking its Sanitized bit.

Depends on D141416

Differential Revision: https://phabricator.services.mozilla.com/D141417
2022-04-20 20:21:46 +00:00
Tom Ritter 43277d4358 Bug 1752332: Make SerializePreferences correctly sanitize preferences r=KrisWright,necko-reviewers,dragana
To do the correct thing in Preferences::SerializePreferences
(which is used during subprocess startup) we need to know if
the destination process is a web content process or not.
We add parameters to
SharedPreferenceSerializer::SerializeToSharedMemory that let
us figure that out.

In Preferences::SerializePreferences we fix the call to
aShouldSanitizeFn to pass the correct destination.

Depends on D141415

Differential Revision: https://phabricator.services.mozilla.com/D141416
2022-04-20 20:21:46 +00:00
Tom Ritter aa6e89410f Bug 1752332: Remove some prefs from the blocklist r=KrisWright
Depends on D141413

Differential Revision: https://phabricator.services.mozilla.com/D141414
2022-04-20 20:21:45 +00:00
Tom Ritter 1cc103189e Bug 1752332: Correctly populate the sanitized bit for PreferenceUpdate r=KrisWright
PreferenceUpdate is the IPC message notifying a child process
that a preference has been updated. To correctly decide whether
or not a value should be sanitized in it, we need to know
what type of destination process it is; we add parameters to
Preferences::GetPreference indicating that.

Inside of ToDomPref we call ShouldSanitizePreference to
correctly populate the sanitized bit.

Depends on D141412

Differential Revision: https://phabricator.services.mozilla.com/D141413
2022-04-20 20:21:44 +00:00
Tom Ritter e9bd1a1b96 Bug 1752332: Rename ShouldSyncPreference to ShouldSanitizePreference r=KrisWright
This simplifies the number of negations needed,
and makes things easy to understand. I think
anyway; I know that without renaming it I made
several annoying-to-diagnose negation errors...

Depends on D141411

Differential Revision: https://phabricator.services.mozilla.com/D141412
2022-04-20 20:21:44 +00:00
Tom Ritter a7e00d1b86 Bug 1752332: Tell ShouldSyncPreference if the destination is a web content process r=KrisWright
A couple places where it might be a web content process
still pass 'false' - this will be corrected in a later
patch.

Depends on D141410

Differential Revision: https://phabricator.services.mozilla.com/D141411
2022-04-20 20:21:44 +00:00
Tom Ritter a77e0fbeb2 Bug 1752332: Move ShouldSyncPreferences to Preferences module r=KrisWright
Depends on D141409

Differential Revision: https://phabricator.services.mozilla.com/D141410
2022-04-20 20:21:43 +00:00
Tom Ritter f0860a2493 Bug 1752332: Add a sanitized property to prefs r=KrisWright
Differential Revision: https://phabricator.services.mozilla.com/D141408
2022-04-20 20:21:42 +00:00
Cristian Tuns 6e25a12cb7 Backed out 16 changesets (bug 1752332) for causing multiple failures on StaticPrefList_media.h
Backed out changeset ec6a5f016318 (bug 1752332)
Backed out changeset 10ac6886fa5e (bug 1752332)
Backed out changeset d37dec5c0d9e (bug 1752332)
Backed out changeset 258d19fe4e28 (bug 1752332)
Backed out changeset 52f6b46250a3 (bug 1752332)
Backed out changeset ab5c00d2fb02 (bug 1752332)
Backed out changeset d72dc14eeafd (bug 1752332)
Backed out changeset 061cdf612d0e (bug 1752332)
Backed out changeset 26707a82d896 (bug 1752332)
Backed out changeset 01ca344dedbf (bug 1752332)
Backed out changeset 22c6c04046b1 (bug 1752332)
Backed out changeset ce809df435e1 (bug 1752332)
Backed out changeset 185026a397b0 (bug 1752332)
Backed out changeset 9dfd530f26b8 (bug 1752332)
Backed out changeset deadcb975866 (bug 1752332)
Backed out changeset 4944ae34f15b (bug 1752332)
2022-04-20 13:10:55 -04:00
Tom Ritter 5a394f247e Bug 1752332: Sanitize preferences in the shared memory region r=KrisWright
Before we would stick all prefs into an immutable shared memory
region and clear our HashMap.

Now we will stick all non-sanitized prefs into the immutable
shared memory region, save the sanitized prefs in a list
temporarily, clear the hashmap, and then repopulate the hashmap
with the sanitized prefs.

As a bit of underlying complexity, to do this we must do some
tricks with the Pref Name Arena which is a chunk of memory
dedicated to storing pref names. That goes away (and we want to
wipe it to save space) - so we just need to move the sanitized
pref names to a new arena.

Depends on D141421

Differential Revision: https://phabricator.services.mozilla.com/D141422
2022-04-20 15:44:41 +00:00
Tom Ritter 5a256881db Bug 1752332: Optimize the crash checks in Check*Value functions r=KrisWright
We busted browser_preferences_usage.js by looking up a
preference too many times.

The reason we are now exceeding the pref-reading limit for
this pref is that inside ShouldSanitizePreference all of
our calls to Preferences::Something(pref_name) are causing
pref lookups.  _Most_ of the time when we are in
ShouldSanitizePreference, we got there from a place that has
the actual pref object; so change the function to take in a
Pref object.

Unfortunately, there is a place we do need to look it up
by name, and that's in Static Pref getters, so we need to
keep that function around (and expose it in Preferences.h)

To minimize code duplication (i.e. not having the exact same
code for ShouldSanitizePreference(Pref) and
ShouldSanitizePreference(PrefWrapper) we do some templating
tricks because even though they expose the same API, they are
not in a class hierarchy where we could just make one function
for a base class.

Depends on D141420

Differential Revision: https://phabricator.services.mozilla.com/D141421
2022-04-20 15:44:41 +00:00
Tom Ritter ab308fb14f Bug 1752332: Remove the shouldSanitizeFunction member r=KrisWright
In the following patch we are going to change the signature of
ShouldSanitizePreference to take a Pref object.  Pref is only
known to the Preferences compilation unit; so to keep this member
(whose signature will change) we would need to expose the Pref
class. However it will only be a forward declaration, one could
not construct a Pref object in e.g. the gtest.

It is simpler to just remove the member entirely and call
ShouldSanitizePreference unconditionally - the member was only
used for the gtest, and while the gtest will be less robust
because of this change, it will still do some testing.

Depends on D141419

Differential Revision: https://phabricator.services.mozilla.com/D141420
2022-04-20 15:44:40 +00:00
Tom Ritter 03973fd595 Bug 1752332: Add preferences that control whether we send user data and/or crash r=KrisWright
Depends on D141418

Differential Revision: https://phabricator.services.mozilla.com/D141419
2022-04-20 15:44:40 +00:00