content/canvas/crashtests/421715-1.html

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     1 <!DOCTYPE html>
     2 <html>
     3   <head>
     4     <script type="text/javascript">
     5       function stringify(a) {
     6         if (a)
     7           return a.toSource();
     8         return ''+a;
     9       }
    10       var args = [undefined, null, [], {}, 0, "0"];
    11       var stringArgs = args.map(stringify);
    13       function test_method(context, method, arity) {
    14         function testParams(existingParams, depth) {
    15           for (var arg of stringArgs) {
    16             var code = "context[method](" + existingParams + arg + ")";
    17             try {
    18               eval(code);
    19             } catch (ex) {
    20               // Exceptions are expected
    21             }
    23             if (depth < arity)
    24               testParams(existingParams + arg + ",", depth + 1);
    25           }
    26         }
    27         testParams("", 1);
    28       }
    30       function startTest() {
    31         var canvas = document.getElementById("img");
    32         var context = canvas.getContext('2d');;
    33         test_method(context, "getImageData", 4);
    34         test_method(context, "putImageData", 3);
    35       }
    36     </script>
    37   </head>
    38   <body onload="startTest()">
    39     <canvas id="img">No canvas support.</canvas>
    40   </body>
    41 </html>

mercurial