content/canvas/crashtests/421715-1.html

branch
TOR_BUG_9701
changeset 11
deefc01c0e14
equal deleted inserted replaced
-1:000000000000 0:17503363ace9
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);
12
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 }
22
23 if (depth < arity)
24 testParams(existingParams + arg + ",", depth + 1);
25 }
26 }
27 testParams("", 1);
28 }
29
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