tor-browser

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

test_drawWindow.html (1771B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <meta charset="utf-8">
      5  <title>Test for canvas drawWindow</title>
      6  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      7  <script src="/tests/SimpleTest/WindowSnapshot.js"></script>
      8  <script type="application/javascript" src="file_drawWindow_common.js"></script>
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     10  <script type="application/javascript">
     11 
     12  SimpleTest.waitForExplicitFinish();
     13  window.addEventListener("load", openSourceWindow);
     14 
     15  var sourceWindow;
     16 
     17  function openSourceWindow(event) {
     18    if (event.target != document) {
     19      return;
     20    }
     21 
     22    sourceWindow = window.open("file_drawWindow_source.html", "",
     23                               "width=200,height=100");
     24    sourceWindow.addEventListener("load", runTests);
     25  }
     26    
     27  async function runTests(event) {
     28    if (event.target != sourceWindow.document) {
     29      return;
     30    }
     31 
     32    let win = document.getElementById("source").contentWindow;
     33    let snapshot = function(context, x, y, width, height, bg) {
     34      context.drawWindow(win, x, y, width, height, bg, 0);
     35    }
     36 
     37    // Run the tests with the source document in an <iframe> within this
     38    // page, which we expect to have transparency.
     39    await runDrawWindowTests(snapshot, true);
     40 
     41    // Run the tests on the same source document, but in a window opened
     42    // by window.open.  We do not expect this to have transparency.
     43    win = sourceWindow;
     44    await runDrawWindowTests(snapshot, false);
     45 
     46    sourceWindow.close();
     47 
     48    SimpleTest.finish();
     49  }
     50 
     51  </script>
     52 </head>
     53 <body>
     54 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a>
     55 <iframe id="source" src="file_drawWindow_source.html" width="200" height="100"></iframe>
     56 </body>
     57 </html>