tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_toBlob_zero_dimension.html (759B)


      1 <!DOCTYPE HTML>
      2 <title>Canvas test: toBlob</title>
      3 <script src="/tests/SimpleTest/SimpleTest.js"></script>
      4 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
      5 <body>
      6 <canvas id="c" width="100" height="0"></canvas>
      7 <script>
      8 
      9 function testblob(blob) {
     10  is(blob, null, "Null blob expected");
     11 }
     12 
     13 function test1(canvas)
     14 {
     15  canvas.toBlob(function(blob) {
     16    testblob(blob);
     17    test2(canvas);
     18  }, "image/png");
     19 }
     20 
     21 function test2(canvas)
     22 {
     23  canvas.width = 0;
     24  canvas.height = 100;
     25  canvas.toBlob(function(blob) {
     26    testblob(blob);
     27    SimpleTest.finish();
     28  }, "image/png");
     29 }
     30 
     31 SimpleTest.waitForExplicitFinish();
     32 
     33 addLoadEvent(function () {
     34 
     35 var canvas = document.getElementById('c');
     36 var ctx = canvas.getContext('2d');
     37 test1(canvas);
     38 
     39 });
     40 </script>