tor-browser

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

reftest_worker.html (1513B)


      1 <!DOCTYPE html>
      2 <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
      3 <meta charset="UTF-8">
      4 <html class="reftest-wait">
      5 <link rel="match" href="{{ reference_file_link }}">
      6 {% if fuzzy %}<meta name=fuzzy content="{{ fuzzy }}">
      7 {% endif %}
      8 {% if timeout %}<meta name="timeout" content="{{ timeout }}">
      9 {% endif %}
     10 <title>Canvas test: {{ name }}</title>
     11 <h1>{{ name }}</h1>
     12 <p class="desc">{{ desc }}</p>
     13 {% if notes %}<p class="notes">{{ notes }}{% endif %}
     14 <canvas id="canvas" width="{{ size[0] }}" height="{{ size[1] }}"{{ canvas }}>
     15  <p class="fallback">FAIL (fallback content)</p>
     16 </canvas>
     17 <script id='myWorker' type='text/worker'>
     18  self.onmessage = {% if test_type == 'promise' %}async {% endif %}function(e) {
     19    const canvas = new OffscreenCanvas({{ size[0] }}, {{ size[1] }});
     20    const ctx = canvas.getContext('2d'{% if attributes %}, {{ attributes }}{% endif %});
     21 
     22    {{ code | trim | indent(4) }}
     23 
     24    const bitmap = canvas.transferToImageBitmap();
     25    self.postMessage(bitmap, bitmap);
     26  };
     27 </script>
     28 <script>
     29  const blob = new Blob([document.getElementById('myWorker').textContent]);
     30  const worker = new Worker(URL.createObjectURL(blob));
     31  worker.addEventListener('message', msg => {
     32    const outputCtx = document.getElementById("canvas").getContext('2d'{% if attributes %}, {{ attributes }}{% endif %});
     33    outputCtx.drawImage(msg.data, 0, 0);
     34    document.documentElement.classList.remove("reftest-wait");
     35  });
     36  worker.postMessage(null);
     37 </script>
     38 </html>