DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (882de07e4cbe)

VCS Links

Line Code
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
<!DOCTYPE HTML>
<html>

<head>
  <title>Autoplay policy test</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
  <script type="text/javascript" src="manifest.js"></script>
  <script type="text/javascript" src="AutoplayTestUtils.js"></script>
</head>

<body>
  <pre id="test">
      <script>

        window.is = SimpleTest.is;
        window.info = SimpleTest.info;

        // Tests that videos can only play audibly in windows/frames
        // which have been activated by same-origin user gesture.

        gTestPrefs.push(["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
          ["media.autoplay.blocking_policy", 0]);

        SpecialPowers.pushPrefEnv({ 'set': gTestPrefs }, () => {
          runTest();
        });

        let testCases = [
          {
            property: "muted",
            inaudible: true,
            audible: false,
          },

          {
            property: "volume",
            inaudible: 0.0,
            audible: 1.0,
          },
        ];

        let child_url = "file_autoplay_policy_unmute_pauses.html";

        async function runTest() {
          for (const testCase of testCases) {
            // Run each test in a new window, to ensure its user gesture
            // activation state isn't tainted by preceeding tests.
            let child = window.open(child_url, "", "width=500,height=500");
            await once(child, "load");
            child.postMessage(testCase, window.origin);
            await nextWindowMessage();
            child.close();
          }
          SimpleTest.finish();
        }

        SimpleTest.waitForExplicitFinish();

      </script>
    </pre>
</body>

</html>