tor-browser

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

containertiming-observe-no-paint.html (1104B)


      1 <!DOCTYPE HTML>
      2 <meta charset=utf-8>
      3 <title>Container Timing: if no paint happens, observer is not called</title>
      4 <body>
      5 <style>
      6 body {
      7  margin: 0;
      8 }
      9 </style>
     10 <script src="/resources/testharness.js"></script>
     11 <script src="/resources/testharnessreport.js"></script>
     12 <script src="/container-timing/resources/container-timing-helpers.js"></script>
     13 <script src="/element-timing/resources/element-timing-helpers.js"></script>
     14 <script>
     15  async_test(function (t) {
     16    assert_implements(window.PerformanceContainerTiming, "PerformanceContainerTiming is not implemented");
     17    const observer = new PerformanceObserver(
     18      function(entryList) {
     19        assert_unreached("No entry is expected with nothing to paint");
     20      }
     21    );
     22    observer.observe({entryTypes: ['container']});
     23 
     24    finishOnElementTiming(t);
     25 
     26    const div = document.createElement('div');
     27    div.setAttribute('containertiming', 'div_ct');
     28    document.body.appendChild(div);
     29 
     30    addPaintingElementTimingAfterDoubleRAF(document.body);
     31  }, 'Container timing did not report paints when there was nothing to paint.');
     32 </script>
     33 
     34 </body>