diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /browser/components/resistfingerprinting/test/mochitest/test_animation_api.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/resistfingerprinting/test/mochitest/test_animation_api.html')
-rw-r--r-- | browser/components/resistfingerprinting/test/mochitest/test_animation_api.html | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/browser/components/resistfingerprinting/test/mochitest/test_animation_api.html b/browser/components/resistfingerprinting/test/mochitest/test_animation_api.html new file mode 100644 index 0000000000..e754eeac7d --- /dev/null +++ b/browser/components/resistfingerprinting/test/mochitest/test_animation_api.html @@ -0,0 +1,78 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=1382545 +--> +<head> + <meta charset="utf-8"> + <title>Test for Bug 1382545</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> + <script type="application/javascript"> + + /** Test for Bug 1382545 */ + SimpleTest.waitForExplicitFinish(); + + // Used by file_animation_api.html + var prefName = ""; + var expectedPrecision = 0; + var resistFingerprinting = false; + var reduceTimerPrecision = false; + + function runTest() { + // No matter what we set the precision to, if we're in ResistFingerprinting mode + // we use the larger of the precision pref and the constant RFP time-atom + if (resistFingerprinting) { + const RFP_TIME_ATOM_MS = 16.667; + expectedPrecision = Math.max(1000*RFP_TIME_ATOM_MS, expectedPrecision); + } + window.open("file_animation_api.html"); + } + + function setupTest(rfp, rtp, ep) { + // Set globals + expectedPrecision = ep; + resistFingerprinting = rfp; + reduceTimerPrecision = rtp; + prefName = ""; + prefName += resistFingerprinting ? "privacy.resistFingerprinting " : ""; + prefName += reduceTimerPrecision ? "privacy.reduceTimerPrecision " : ""; + SpecialPowers.pushPrefEnv({"set": + [ + ["dom.animations-api.timelines.enabled", true], + ["privacy.resistFingerprinting", resistFingerprinting], + ["privacy.reduceTimerPrecision", reduceTimerPrecision], + ["privacy.resistFingerprinting.reduceTimerPrecision.microseconds", expectedPrecision], + ], + }, runTest); + } + + var testIndx = 0; + var testSequence = [ + [true, false, 100000], + [false, true, 100000], + [true, false, 50000], + [false, true, 50000], + [true, false, 100], + [false, true, 100], + [true, true, 13], + [false, true, 13], + ]; + + window.onload = () => { + setupTest(testSequence[testIndx][0], testSequence[testIndx][1], testSequence[testIndx][2]); + }; + + function done() { + testIndx++; + if (testIndx == testSequence.length) { + SimpleTest.finish(); + } else { + setupTest(testSequence[testIndx][0], testSequence[testIndx][1], testSequence[testIndx][2]); + } + } + </script> +</head> +<body> +</body> +</html> |