layout/base/tests/test_bug469170.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial