tor-browser

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

not-broken-while-load-task-scheduled.html (1157B)


      1 <!doctype html>
      2 <title>Image shouldn't be broken while load task is scheduled.</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <body>
      6 <script>
      7 async function run_test(prop) {
      8  let img = new Image();
      9  img.width = 50;
     10  img.height = 50;
     11  img.alt = "Anything non-empty";
     12  img[prop] = `/images/green.png?not-broken-while-load-task-scheduled-` + Math.random();
     13  let load = new Promise(r => img.addEventListener("load", r, { once: true }));
     14  document.body.appendChild(img);
     15 
     16  assert_equals(img.clientWidth, 50, "clientWidth");
     17  assert_equals(img.clientHeight, 50, "clientHeight");
     18  assert_equals(getComputedStyle(img).height, "50px", "Computed height");
     19  assert_equals(getComputedStyle(img).width, "50px", "Computed height");
     20 
     21  await load;
     22 
     23  assert_equals(img.clientWidth, 50, "clientWidth");
     24  assert_equals(img.clientHeight, 50, "clientHeight");
     25  assert_equals(getComputedStyle(img).height, "50px", "Computed height");
     26  assert_equals(getComputedStyle(img).width, "50px", "Computed height");
     27 }
     28 
     29 promise_test(() => run_test("src"));
     30 promise_test(() => run_test("srcset"));
     31 </script>