tor-browser

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

delay-load-event-until-move-to-empty-source.html (915B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>Inline image element blocks load until source is changed to empty source</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <img src="/images/blue.png?pipe=trickle(d100)">
      7 <script>
      8 
      9 async_test(t => {
     10  const image = document.querySelector("img");
     11 
     12  assert_false(image.complete, "The image is loading initially");
     13 
     14  // Complete the test as soon as we obtained the window "load" event,
     15  // which should happen as soon as the image stops loading by moving
     16  // to an empty source.
     17  window.addEventListener("load", t.step_func_done(() => {
     18      assert_true(image.complete, "The image is no longer loading once the window 'load' event is dispatched");
     19  }));
     20 
     21  // Stop loading the image.
     22  image.src = "";
     23 }, "Image element delays window's load event until the image changes to empty source");
     24 
     25 </script>