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