content/canvas/crashtests/421715-1.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/canvas/crashtests/421715-1.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,41 @@
     1.4 +<!DOCTYPE html>
     1.5 +<html>
     1.6 +  <head>
     1.7 +    <script type="text/javascript">
     1.8 +      function stringify(a) {
     1.9 +        if (a)
    1.10 +          return a.toSource();
    1.11 +        return ''+a;
    1.12 +      }
    1.13 +      var args = [undefined, null, [], {}, 0, "0"];
    1.14 +      var stringArgs = args.map(stringify);
    1.15 +
    1.16 +      function test_method(context, method, arity) {
    1.17 +        function testParams(existingParams, depth) {
    1.18 +          for (var arg of stringArgs) {
    1.19 +            var code = "context[method](" + existingParams + arg + ")";
    1.20 +            try {
    1.21 +              eval(code);
    1.22 +            } catch (ex) {
    1.23 +              // Exceptions are expected
    1.24 +            }
    1.25 +
    1.26 +            if (depth < arity)
    1.27 +              testParams(existingParams + arg + ",", depth + 1);
    1.28 +          }
    1.29 +        }
    1.30 +        testParams("", 1);
    1.31 +      }
    1.32 +
    1.33 +      function startTest() {
    1.34 +        var canvas = document.getElementById("img");
    1.35 +        var context = canvas.getContext('2d');;
    1.36 +        test_method(context, "getImageData", 4);
    1.37 +        test_method(context, "putImageData", 3);
    1.38 +      }
    1.39 +    </script>
    1.40 +  </head>
    1.41 +  <body onload="startTest()">
    1.42 +    <canvas id="img">No canvas support.</canvas>
    1.43 +  </body>
    1.44 +</html>

mercurial