diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /browser/components/resistfingerprinting/test/mochitest/test_animation_api.html | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
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..74f6f3083e --- /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> |