layout/base/tests/test_bug518777.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/base/tests/test_bug518777.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,48 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=518777
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 518777</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.13 +
    1.14 +  <script>
    1.15 +  SimpleTest.waitForExplicitFinish();
    1.16 +
    1.17 +  function dotest() {
    1.18 +    var canvasWidth = 50;
    1.19 +    var canvasHeight = 50;
    1.20 +    var source = document.getElementById("source").contentWindow;
    1.21 +    rect = { left: 25, top: 25,
    1.22 +             width: canvasWidth, height: canvasHeight };
    1.23 +    var canvas = SpecialPowers.snapshotRect(source, rect, "transparent");
    1.24 +    var context = canvas.getContext("2d");
    1.25 +
    1.26 +    var data = context.getImageData(0, 0, canvasWidth, canvasHeight).data;
    1.27 +    var i;
    1.28 +    for (i = 0; i < data.length; i += 4) {
    1.29 +      if (data[i] != 0 || data[i + 1] != 0 || data[i + 2] != 255 || data[i + 3] != 255)
    1.30 +        break;
    1.31 +    }
    1.32 +    ok(i >= data.length, "all pixels blue");
    1.33 +
    1.34 +    SimpleTest.finish();
    1.35 +  }
    1.36 +  </script>
    1.37 +</head>
    1.38 +<body>
    1.39 +<p><a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=518777">Mozilla Bug 518777</a></p>
    1.40 +
    1.41 +<!--
    1.42 +iframe source is
    1.43 +<html><body onload='window.scrollTo(0,99999999); document.documentElement.offsetWidth; window.parent.dotest();' style='background: rgb(0,0,255); width: 100px; height: 50100px;'></body></html>
    1.44 +-->
    1.45 +<iframe id="source" width="50" height="50"
    1.46 +       src="data:text/html,%3Chtml%3E%3Cbody%20onload%3D%27window.scrollTo%280%2C99999999%29%3B%20document.documentElement.offsetWidth%3B%20window.parent.dotest%28%29%3B%27%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>
    1.47 +
    1.48 +<pre id="test">
    1.49 +</pre>
    1.50 +</body>
    1.51 +</html>

mercurial