test_mediacapabilities_resistfingerprinting.html (2167B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Test for Bug 1369309</title> 6 <script src="/tests/SimpleTest/SimpleTest.js"></script> 7 <script type="application/javascript" src="manifest.js"></script> 8 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 9 </head> 10 <body> 11 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1461454">Mozilla Bug 1461454</a> 12 <a target="_blank" href="https://gitlab.torproject.org/tpo/applications/tor-browser/-/issues/13543">Tor Issue 13543</a> 13 14 <script type="application/javascript"> 15 async function testWhetherSpoofed(resistFingerprinting) { 16 17 var unsupportedVideoConfiguration = { 18 contentType: 'video/bogus', 19 width: 800, 20 height: 600, 21 bitrate: 3000, 22 framerate: 24, 23 }; 24 var supportedVideoConfiguration = { 25 contentType: 'video/webm; codecs="vp09.00.10.08"', 26 width: 800, 27 height: 600, 28 bitrate: 3000, 29 framerate: 24, 30 }; 31 32 await SpecialPowers.pushPrefEnv({ 33 "set": [ 34 ["privacy.resistFingerprinting", resistFingerprinting] 35 ], 36 }); 37 38 var result; 39 40 result = await navigator.mediaCapabilities.decodingInfo({ 41 type: 'file', 42 video: unsupportedVideoConfiguration 43 }); 44 is(result.supported, false, "video/bogus should be unsupported."); 45 is(result.smooth, false, "smooth is false when unsupported."); 46 is(result.powerEfficient, false, "powerEfficient is false when unsupported."); 47 48 result = await navigator.mediaCapabilities.decodingInfo({ 49 type: 'file', 50 video: supportedVideoConfiguration 51 }); 52 is(result.supported, true, "'video/webm; codecs=\"vp09.00.10.08\"' should be supported."); 53 if (resistFingerprinting) { 54 is(result.smooth, true, "smooth should be spoofed to true in RFP mode."); 55 is(result.powerEfficient, false, "powerEfficient should be spoofed to false in RFP mode."); 56 } 57 } 58 59 async function start() { 60 await testWhetherSpoofed(true); 61 await testWhetherSpoofed(false); 62 SimpleTest.finish(); 63 } 64 65 SimpleTest.waitForExplicitFinish(); 66 start(); 67 </script> 68 </body> 69 </html>