tor-browser

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

async-02.html (1030B)


      1 <html>
      2  <head>
      3    <title>Inline async module script without external deps onload blocking</title>
      4    <link rel="help" href="https://svgwg.org/svg2-draft/interact.html#ScriptElement"/>
      5    <meta name=timeout content=long>
      6    <script src="/resources/testharness.js"></script>
      7    <script src="/resources/testharnessreport.js"></script>
      8  </head>
      9  <body>
     10    <svg>
     11      <script>
     12        let loadFired = false;
     13        let moduleRan = false
     14        let test = async_test("Inline async module script vs. onload");
     15        window.addEventListener("load", test.step_func(function() {
     16          loadFired = true;
     17          assert_true(moduleRan, "Module should have run before the load event");
     18          test.step_timeout(function() {
     19            test.done();
     20          }, 0);
     21        }));
     22      </script>
     23      <script type="module" async>
     24        moduleRan = true;
     25        test.step_func(function() {
     26          assert_false(loadFired, "onload should not have fired yet");
     27        });
     28      </script>
     29    </svg>
     30  </body>
     31 </html>