tor-browser

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

detached-HTMLCanvasElement.html (833B)


      1 <!DOCTYPE html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <body>
      5 <script>
      6 
      7 async_test(t => {
      8  let iframe = document.createElement('iframe');
      9  let html = "<canvas id='canvas' width=10 height=10></canvas>";
     10  iframe.srcdoc = html;
     11  iframe.onload = t.step_func_done(() => {
     12    // This detaches the frame while retaining a reference to an
     13    // HTMLCanvasElement from it.
     14    let canvas = iframe.contentWindow.document.getElementById('canvas');
     15    document.body.removeChild(iframe);
     16 
     17    // Creation of the ImageCapture object (as part of the MediaStreamTrack)
     18    // should be safe even if the frame is detached.
     19    canvas.captureStream();
     20  });
     21 
     22  document.body.appendChild(iframe);
     23 }, 'MediaStreamTrack can be obtained from a detached frame');
     24 
     25 </script>
     26 </body>