tor-browser

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

test_bug469170.html (1352B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=469170
      5 -->
      6 <head>
      7  <title>Test for Bug 469170</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     10 </head>
     11 <body onload="runTest();">
     12 <p><a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469170">Mozilla Bug 469170</a></p>
     13 
     14 <iframe id="source" width="50" height="50" srcdoc="<html></html>"></iframe>
     15 
     16 <pre id="test">
     17 <script type="application/javascript">
     18 
     19 /** Test for Bug 469170 */
     20 
     21 SimpleTest.waitForExplicitFinish();
     22 
     23 function runTest() {
     24  var source = document.getElementById('source').contentWindow;
     25  rect = { left: 0, top: 0,
     26           width: source.innerWidth, height: source.innerHeight };
     27  var canvas = SpecialPowers.snapshotRect(source, rect, "transparent");
     28  var context = canvas.getContext("2d");
     29 
     30  var components = [ "red", "green", "blue", "alpha" ];
     31 
     32  var data = context.getImageData(0, 0, canvas.width, canvas.height).data;
     33  var failed = false;
     34  for (var i = 0; i < data.length; i++) {
     35    if (data[i] != 0) {
     36      is(data[i], 0, "pixel " + Math.floor(i/4) + " " + components[i%4]);
     37      failed = true;
     38    }
     39  }
     40  if (!failed) {
     41    ok(!failed, "all pixels fully transparent");
     42  }
     43  SimpleTest.finish();
     44 }
     45 </script>
     46 </pre>
     47 </body>
     48 </html>