layout/base/tests/test_bug469170.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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 type="application/javascript" 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>
    14 <iframe id="source" width="50" height="50"
    15        src="data:text/html,%3Chtml%3E%3C%2Fhtml%3E"></iframe>
    17 <pre id="test">
    18 <script type="application/javascript">
    20 /** Test for Bug 469170 **/
    22 SimpleTest.waitForExplicitFinish();
    24 function runTest() {
    25   var source = document.getElementById('source').contentWindow;
    26   rect = { left: 0, top: 0,
    27            width: source.innerWidth, height: source.innerHeight };
    28   var canvas = SpecialPowers.snapshotRect(source, rect, "transparent");
    29   var context = canvas.getContext("2d");
    31   var components = [ "red", "green", "blue", "alpha" ];
    33   var data = context.getImageData(0, 0, canvas.width, canvas.height).data;
    34   var failed = false;
    35   for (var i = 0; i < data.length; i++) {
    36     if (data[i] != 0) {
    37       is(data[i], 0, "pixel " + Math.floor(i/4) + " " + components[i%4]);
    38       failed = true;
    39     }
    40   }
    41   if (!failed) {
    42     ok(!failed, "all pixels fully transparent");
    43   }
    44   SimpleTest.finish();
    45 }
    46 </script>
    47 </pre>
    48 </body>
    49 </html>

mercurial