tor-browser

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

available-images-onload.html (1326B)


      1 <!doctype html>
      2 <html>
      3 <title>Ensure images from available images list can be drawn to a canvas</title>
      4 <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-list-of-available-images">
      5 <meta charset="utf-8">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 <div id="log"></div>
      9 <script>
     10  async_test(function(t) {
     11    var i = new Image();
     12    i.onerror = t.unreached_func();
     13    i.onload = t.step_func(function() {
     14      var i2 = new Image();
     15      // Potentially start multiple image loading tasks by performing several
     16      // relevant mutations. This could lead to an invalid state later in an
     17      // erroneous implementation.
     18      i2.crossOrigin = true;
     19      // Start an image loading task that is expected to short-circuit since
     20      // the requested image is present in the list of available images.
     21      i2.src = "3.jpg";
     22      i2.onerror = t.unreached_func();
     23      // Ensure the loaded image is in a state that is usable by a 2d canvas.
     24      i2.onload = t.step_func_done(function() {
     25        var c = document.createElement('canvas');
     26        var ctx = c.getContext('2d');
     27        ctx.drawImage(i2, 0, 0);
     28      });
     29    });
     30    // Request an image which should be added to the list of available images.
     31    i.src = "3.jpg";
     32  });
     33 </script>