tor-browser

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

top-level-await.https.html (919B)


      1 <!DOCTYPE html>
      2 <html class="reftest-wait">
      3 <link rel="help" href="https://html.spec.whatwg.org/#calling-scripts">
      4 <link rel="match" href="top-level-await-ref.html">
      5 <style>
      6 #output {
      7    width: 100px;
      8    height: 100px;
      9    background-image: paint(rects);
     10    background-color: blue;
     11 }
     12 </style>
     13 <script src="/common/reftest-wait.js"></script>
     14 <script src="/common/worklet-reftest.js"></script>
     15 <body>
     16 <div id="output"></div>
     17 
     18 <script id="code" type="text/worklet">
     19 // This will cause a syntax error, and the paint processor will never get registered, in browsers
     20 // without top-level await support.
     21 await 1;
     22 
     23 registerPaint('rects', class {
     24    async paint(ctx, geom) {
     25        ctx.fillStyle = 'green';
     26        ctx.fillRect(0, 0, geom.width, geom.height);
     27    }
     28 });
     29 </script>
     30 
     31 <script>
     32 "use strict";
     33 importWorkletAndTerminateTestAfterAsyncPaint(CSS.paintWorklet, document.getElementById('code').textContent);
     34 </script>