tor-browser

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

content-visibility-auto-relevancy-updates-stop-ticking-002.html (1569B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>Content Visibility: stop ticking after relevancy updates</title>
      4 <!--
      5    Adapted from testing/web-platform/tests/css/css-contain/content-visibility/content-visibility-intrinsic-size-001.html
      6 -->
      7 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1880928">
      8 <script src="/resources/testharness.js"></script>
      9 <script src="/resources/testharnessreport.js"></script>
     10 <script src="/common/rendering-utils.js"></script>
     11 
     12 <style>
     13  #container {
     14      position: sticky;
     15  }
     16  #container > div {
     17      content-visibility: auto;
     18      contain-intrinsic-size: 1px 5000px;
     19  }
     20 </style>
     21 <div id="container">
     22  <div>X</div>
     23  <div id="target">XX</div>
     24  <div>XXX</div>
     25  <div>XXXX</div>
     26 </div>
     27 <script>
     28  target.scrollIntoView();
     29 </script>
     30 
     31 <script>
     32 function hasPendingTick() {
     33  return SpecialPowers.wrap(window).windowUtils.refreshDriverHasPendingTick;
     34 }
     35 
     36 // See comment in layout/base/tests/test_bug1756118.html about why the timeouts
     37 // etc.
     38 async function expectTicksToStop() {
     39  for (let i = 0; i < 100; i++) {
     40    await new Promise(r => setTimeout(r, 8));
     41    if(!hasPendingTick()) {
     42      break;
     43    }
     44  }
     45  assert_false(hasPendingTick(), "refresh driver should have eventually stopped ticking");
     46 }
     47 
     48 promise_test(async function(t) {
     49  await new Promise(resolve => { window.addEventListener("load", resolve); });
     50  await SpecialPowers.pushPrefEnv({'set':
     51                                   [['layout.keep_ticking_after_load_ms', 0]]});
     52  await waitForAtLeastOneFrame();
     53  await expectTicksToStop();
     54 });
     55 </script>