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 (409f3966645a)

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 65 66
<!DOCTYPE HTML>
<html>
  <head>
    <title>Autoplay policy window</title>
    <style>
      video {
        width: 50%;
        height: 50%;
      }
    </style>
    <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    <script type="text/javascript" src="manifest.js"></script>
    <script type="text/javascript" src="AutoplayTestUtils.js"></script>
  </head>
  <body>
    <pre id="test">
      <script>

        function testAutoplayInWindow(test_case, parent_window) {
          log("testAutoplayInWindow: " + test_case.name);
          playAndPostResult(test_case.muted, parent_window);
        }

        async function testAutoplayInChildFrame(test_case, parent_window) {
          log("testAutoplayInChildFrame: " + test_case.name);
          // Create a child iframe...
          var frame = document.createElement("iframe");
          var origin = test_case.same_origin_child
            ? "http://mochi.test:8888" : "http://example.org";
          frame.src = origin + "/tests/dom/media/test/file_autoplay_policy_activation_frame.html";
          // Wait for it to load...
          document.body.appendChild(frame);
          is((await nextWindowMessage()).data, "ready", "Expected a 'ready' message");
          // Click the iframe to activate if appropriate.
          if (test_case.activated_child) {
            frame.contentWindow.postMessage("click", "*");
          }
          // Ask the child iframe to try to play video.
          let play_message = test_case.muted ? "play-muted" : "play-audible";
          frame.contentWindow.postMessage(play_message, "*");
          // Wait for the iframe to tell us whether it could play video.
          let result = await nextWindowMessage();
          // Report whether the iframe could play to the parent.
          parent_window.postMessage(result.data, "*");
        }

        nextWindowMessage().then(
          (event) => {
            let test_case = event.data;
            // Click the window to activate if appropriate.
            if (test_case.activated_parent) {
              synthesizeMouseAtCenter(document.body, {});
            }
            let parent_window = event.source;
            if (test_case.same_origin_child === undefined) {
              testAutoplayInWindow(test_case, parent_window);
            } else {
              testAutoplayInChildFrame(test_case, parent_window);
            }
          });

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