1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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>
|