tor-browser

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

update-src-complete.html (803B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>Changing the img src should retain the 'complete' property</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <p id="display"><img src="image.png"></p>
      7 <script>
      8    setup({ single_test: true });
      9 
     10    function check() {
     11        var img = document.querySelector("img");
     12        assert_true(img.complete, "By onload, image should have loaded");
     13        img.src = `image.png?${Math.random()}`;
     14        assert_false(img.complete, "Now that we're loading we should no longer be complete");
     15        img.onload = function () {
     16            assert_true(img.complete, "The new thing should have loaded.");
     17            done();
     18        }
     19    }
     20 
     21    onload = function () {
     22        check();
     23    };
     24 
     25 </script>