Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
-
CI results over the last 22 days5,646Runs99.93%Pass3Failures1Timeouts0Crashes0Skips
Runs with issues per day (up to 0.5%) Nov 13Dec 4- Failures
- Timeouts
- Manifest: toolkit/components/resistfingerprinting/tests/xpcshell/xpcshell.toml
/* Any copyright is dedicated to the Public Domain.
"use strict";
// Sandboxes compute their reduce timer precision caller type when they are
// created. Make sure it is refreshed when the RFP prefs change afterwards.
const PRECISION_MS = 100;
function sandboxTimeIsRounded(sandbox) {
const values = [];
let last = -1;
while (values.length < 5) {
const now = Cu.evalInSandbox("Date.now()", sandbox);
if (now !== last) {
values.push(now);
last = now;
}
}
return values.every(v => v % PRECISION_MS === 0);
}
add_setup(() => {
Services.prefs.setBoolPref("privacy.reduceTimerPrecision", false);
Services.prefs.setIntPref(
"privacy.resistFingerprinting.reduceTimerPrecision.microseconds",
PRECISION_MS * 1000
);
Services.prefs.setBoolPref("privacy.resistFingerprinting.pbmode", false);
registerCleanupFunction(() => {
Services.prefs.clearUserPref("privacy.reduceTimerPrecision");
Services.prefs.clearUserPref(
"privacy.resistFingerprinting.reduceTimerPrecision.microseconds"
);
Services.prefs.clearUserPref("privacy.resistFingerprinting.pbmode");
Services.prefs.clearUserPref("privacy.resistFingerprinting");
});
});
add_task(function test_enable_rfp_after_sandbox_creation() {
Services.prefs.setBoolPref("privacy.resistFingerprinting", false);
Assert.ok(
!sandboxTimeIsRounded(sandbox),
"Sandbox time is not rounded without RFP"
);
Services.prefs.setBoolPref("privacy.resistFingerprinting", true);
Assert.ok(
sandboxTimeIsRounded(sandbox),
"Sandbox time is rounded after enabling RFP"
);
});
add_task(function test_disable_rfp_after_sandbox_creation() {
Services.prefs.setBoolPref("privacy.resistFingerprinting", true);
Assert.ok(sandboxTimeIsRounded(sandbox), "Sandbox time is rounded with RFP");
Services.prefs.setBoolPref("privacy.resistFingerprinting", false);
Assert.ok(
!sandboxTimeIsRounded(sandbox),
"Sandbox time is not rounded after disabling RFP"
);
});