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