Bug 1424341 Add privacy.reduceTimerPrecision and privacy.reduceTimerPrecision.microseconds prefs r=bkelly,timhuang

This pref does not override privacy.resistFingerprinting, but when it is set (and
privacy.resistFingerprinting is not) we will still adjust the precision of almost
all timers. The adjustment amount is the second pref, which is defaulted to
20us but now dynamically adjustable (in the scale of microseconds.)

This patch does _not_ address the performance API, which privacy.resistFingerprinting
disables.

We are landing this preffed on at the current value we clamp performance.now() at
which is 20us.

MozReview-Commit-ID: ESZlSvH9w1D
This commit is contained in:
Tom Ritter
2018-01-09 14:58:34 -06:00
parent 5e3ebb2b67
commit 0a8b5b6e7c
6 changed files with 75 additions and 19 deletions

View File

@@ -5016,7 +5016,7 @@ Preferences::AddAtomicUintVarCache(Atomic<uint32_t, Order>* aCache,
// Since the definition of template functions is not in a header file, we
// need to explicitly specify the instantiations that are required. Currently
// only the order=Relaxed variant is needed.
// limited orders are needed and therefore implemented.
template nsresult
Preferences::AddAtomicBoolVarCache(Atomic<bool, Relaxed>*, const char*, bool);
@@ -5040,6 +5040,11 @@ Preferences::AddAtomicUintVarCache(Atomic<uint32_t, Relaxed>*,
const char*,
uint32_t);
template nsresult
Preferences::AddAtomicUintVarCache(Atomic<uint32_t, ReleaseAcquire>*,
const char*,
uint32_t);
static void
FloatVarChanged(const char* aPref, void* aClosure)
{