|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=514127 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 514127</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=514127">Mozilla Bug 514127</a></p> |
|
13 |
|
14 <!-- |
|
15 iframe source is |
|
16 <html><body style='background: rgb(0,0,255); width: 100px; height: 50100px;'></body></html> |
|
17 --> |
|
18 <iframe id="source" width="50" height="50" |
|
19 src="data:text/html,%3Chtml%3E%3Cbody%20style%3D%27background%3A%20rgb%280%2C0%2C255%29%3B%20width%3A%20100px%3B%20height%3A%2050100px%3B%27%3E%3C%2Fbody%3E%3C%2Fhtml%3E"></iframe> |
|
20 |
|
21 <pre id="test"> |
|
22 <script type="application/javascript"> |
|
23 |
|
24 /** Test for Bug 514127 **/ |
|
25 |
|
26 SimpleTest.waitForExplicitFinish(); |
|
27 |
|
28 function runTest() { |
|
29 |
|
30 var source = document.getElementById('source').contentWindow; |
|
31 var canvasWidth = 50; |
|
32 var canvasHeight = 50; |
|
33 |
|
34 rect = { left: 25, top: 50000, |
|
35 width: canvasWidth, height: canvasHeight }; |
|
36 var canvas = SpecialPowers.snapshotRect(source, rect, "transparent"); |
|
37 var context = canvas.getContext("2d"); |
|
38 |
|
39 var data = context.getImageData(0, 0, canvasWidth, canvasHeight).data; |
|
40 var failed = false; |
|
41 for (var i = 0; i < data.length; i+=4) { |
|
42 if (data[i] != 0 || data[i+1] != 0 || data[i+2] != 255 || data[i+3] != 255) { |
|
43 failed = true; |
|
44 break; |
|
45 } |
|
46 } |
|
47 ok(!failed, "all pixels blue"); |
|
48 |
|
49 SimpleTest.finish(); |
|
50 } |
|
51 |
|
52 </script> |
|
53 </pre> |
|
54 </body> |
|
55 </html> |