tor-browser

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

cross-origin-video.html (1338B)


      1 <!doctype html>
      2 <title>Test cross origin load of media document in parts</title>
      3 <link rel="motivation" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1781759">
      4 <script src=/resources/testharness.js></script>
      5 <script src=/resources/testharnessreport.js></script>
      6 <script src="/common/get-host-info.sub.js"></script>
      7 <body></body>
      8 <script>
      9 promise_test(async () => {
     10  const frame = document.createElement('iframe');
     11  const dir = location.pathname.replace(/\/[^\/]*$/, '/');
     12  frame.src =
     13    // remote origin intermediate document
     14    get_host_info().HTTP_NOTSAMESITE_ORIGIN + dir
     15    // iframe-document.sub.html has an iframe with src=childsrc.
     16    + 'resources/iframe-document.sub.html?childsrc='
     17    // same origin video document, so that we can play().
     18    + get_host_info().ORIGIN
     19    // 'PartialContent' ensures that the entire video resource does not load
     20    // in one fetch.
     21    + '/service-workers/service-worker/resources/fetch-access-control.py?'
     22    + 'VIDEO%26PartialContent';
     23 
     24  let v = document.createElement("video");
     25  frame.src += "%26mp4";
     26 
     27  document.body.appendChild(frame);
     28  await new Promise(resolve => frame.onload = resolve);
     29 
     30  const inner = frame.contentWindow.frames[0];
     31  const video = inner.document.body.childNodes[0];
     32  video.muted = true;  // to allow playback
     33  return video.play();
     34 });
     35 </script>