The Firefox source code's 'StaticPrefs' system (as of Firefox 128)
The news of the time interval is that Mozilla is selling out Firefox
users once again (although Firefox remains far better than Chrome),
in the form of 'Privacy-Preserving Attribution', which you might
impolitely call 'browser managed tracking'. Mozilla enabled this
by default in Firefox 128 (cf), and if you
didn't know already you can read about how to disable it here
or here.
In the process of looking into all of this, I attempted to find
where in the Firefox code the special
dom.private-attribution.submission.enabled
was actually used,
but initially failed. Later, with guidance from @mcc's information, I managed to
find the code
and learned something about how Firefox handles certain 'about:config'
preferences through a system called 'StaticPrefs'.
The Firefox source code defines a big collection of statically known
about:config preferences, with commentary, default values, and their
types, in modules/libpref/init/StaticPrefList.yaml
(reading the comments for preferences you're interested is often
quite useful). Our dom.private-attribution.submission.enabled
preference is defined there. However, you will search the Firefox
source tree in vain for any direct reference to accessing these
preferences from C++ code, because their access functions are
actually created as part of the build process, and even in the build
tree they're accessed through #defines that are in StaticPrefListBegin.h.
In the normal C++ code, all that you'll see is calls to
'StaticPrefs:<underscore_name>()', with the name of the function
being the name of the preference with .'s converted to '_'
(underscores), giving names like
dom_private_attribution_submission_enabled. You can see this
in dom/privateattribution/PrivateAttribution.cpp
in functions like 'PrivateAttribution::SaveImpression()'
(for as long as this source code lives in Firefox before Mozilla
rips it out, which I hope is immediately).
(In the Firefox build tree, the generated file to look at is modules/libpref/init/StaticPrefList_dom.h.)
Some preferences in StaticPrefList.yaml aren't accessed this way by C++ code (currently, those with 'mirror: never' that are used in C++ code), so their name will appear in .cpp files in the Firefox source if you search for them. I believe that Firefox C++ code can also use additional preferences not listed in StaticPrefList, but it will obviously have to access those preferences using their preferences name. There are various C++ interfaces for working with such preferences, so you'll see things like a preference's value looked up by its name, or its name passed to methods like nsIPrincipal's 'IsURIInPrefList()'.
A significant amount of Firefox is implemented in JavaScript. As far as I know, that JavaScript doesn't use StaticPrefs or any equivalent of it and always accesses preferences by their normal about:config name.
Comments on this page:
|
|