tor-browser

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

delay-load-event.html (797B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>Inline image element blocks load</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script>
      7 var img_loaded = false;
      8 </script>
      9 <img src="/images/blue.png?pipe=trickle(d2)" onload="img_loaded = true;">
     10 <script>
     11 test(function() {
     12  assert_false(img_loaded);
     13 }, "script execution doesn't wait for the image to load");
     14 
     15 async_test(function(t) {
     16  document.addEventListener("DOMContentLoaded", t.step_func_done(function() {
     17    assert_false(img_loaded);
     18  }));
     19 }, "DOMContentLoaded doesn't wait for images");
     20 
     21 async_test(function(t) {
     22  window.addEventListener("load", t.step_func_done(function() {
     23    assert_true(img_loaded);
     24  }));
     25 }, "Image element delays window's load event");
     26 </script>