tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_autoplay_policy_eventdown_activation.html (1613B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 
      4 <head>
      5  <title>Autoplay policy test</title>
      6  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      7  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
      8  <script type="text/javascript" src="manifest.js"></script>
      9  <script type="text/javascript" src="AutoplayTestUtils.js"></script>
     10 </head>
     11 
     12 <body>
     13  <pre id="test">
     14      <script>
     15 
     16        // Tests that we gesture activate on mousedown and keydown.
     17 
     18        gTestPrefs.push(["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
     19          ["media.autoplay.blocking_policy", 0]);
     20 
     21        SpecialPowers.pushPrefEnv({ 'set': gTestPrefs }, () => {
     22          runTest();
     23        });
     24 
     25        let child_url = "file_autoplay_policy_eventdown_activation.html";
     26 
     27        async function runTest() {
     28          // Run test in a new window, to ensure its user gesture
     29          // activation state isn't tainted by preceeding tests.
     30          {
     31            let child = window.open(child_url, "", "width=500,height=500");
     32            await once(child, "load");
     33            child.postMessage("run keydown test", window.origin);
     34            await nextWindowMessage();
     35            child.close();
     36          }
     37 
     38          {
     39            let child = window.open(child_url, "", "width=500,height=500");
     40            await once(child, "load");
     41            child.postMessage("run mousedown test", window.origin);
     42            await nextWindowMessage();
     43            child.close();
     44          }
     45 
     46          SimpleTest.finish();
     47        }
     48 
     49        SimpleTest.waitForExplicitFinish();
     50 
     51      </script>
     52    </pre>
     53 </body>
     54 
     55 </html>