tor-browser

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

delay-load-event-detached.html (774B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>Detached image 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 
      9 var img = new Image();
     10 img.onload = function() {
     11  img_loaded = true;
     12 };
     13 img.src = "/images/blue.png?pipe=trickle(d2)";
     14 
     15 test(function() {
     16  assert_false(img_loaded);
     17 }, "setting img.src is async");
     18 
     19 async_test(function(t) {
     20  document.addEventListener("DOMContentLoaded", t.step_func_done(function() {
     21    assert_false(img_loaded);
     22  }));
     23 }, "DOMContentLoaded doesn't wait for images");
     24 
     25 async_test(function(t) {
     26  window.addEventListener("load", t.step_func_done(function() {
     27    assert_true(img_loaded);
     28  }));
     29 }, "load waits for images");
     30 </script>