5 <title>WebVTT: ResistFingerprinting
</title>
6 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
7 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
13 <video width=
"600" height=
"400" controls
onloadeddata=
"handleOnLoadedData()">
14 <source src=
"gizmo.mp4" type=
"video/mp4">
15 <track label=
"VTT1" kind=
"subtitles" srclang=
"en" src=
"basicvtt-server.sjs?request=vtt&id=test_webvtt_resistfingerprinting.html" />
16 <track label=
"VTT2" kind=
"subtitles" srclang=
"es" src=
"basicvtt-server.sjs?request=vtt&id=test_webvtt_resistfingerprinting.html" />
17 <track label=
"VTT3" kind=
"subtitles" srclang=
"tr" src=
"basicvtt-server.sjs?request=vtt&id=test_webvtt_resistfingerprinting.html" default
/>
20 <script class=
"testbody" type=
"text/javascript">
21 SimpleTest.waitForExplicitFinish();
22 SimpleTest.requestFlakyTimeout(
"Need to wait for all VTT files to be loaded");
25 async function startTest() {
26 await SpecialPowers.pushPrefEnv({
28 [
"privacy.resistFingerprinting", true]
32 iteration = await fetch(
"basicvtt-server.sjs?request=newIteration")
33 .then(response =
> response.text());
35 const video = document.getElementById(
"video").content.cloneNode(true);
36 video.querySelectorAll(
"track").forEach(track =
> {
37 track.src = track.src + iteration;
39 document.getElementById(
"content").appendChild(video);
42 async function handleOnLoadedData() {
43 // Wait for
5 minutes at most
44 for (let i =
0; i <
5 *
60; i++) {
45 const shouldEnd = await fetch(
"basicvtt-server.sjs?request=count&id=test_webvtt_resistfingerprinting.html" + iteration)
46 .then(response =
> response.text())
48 info(
"Number of VTT files loaded: " + text);
51 ok(true,
"All VTT files are loaded");
55 ok(false,
"Too many VTT files are loaded");
60 ok(false,
"Failed to fetch count: " + error);
66 await new Promise(resolve =
> setTimeout(resolve,
1000));
69 await SpecialPowers.popPrefEnv();