tor-browser

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

containertiming-with-child-ignore-and-child-img.html (1620B)


      1 <!DOCTYPE HTML>
      2 <meta charset=utf-8>
      3 <title>Container Timing: an image inside a containertiming-ignore inside a containertiming root</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    // Add a div that is the container timing root
     27    const div1 = document.createElement('div');
     28    div1.setAttribute('containertiming', 'div1_ct');
     29    document.body.appendChild(div1);
     30 
     31    // Intermediate ignore should block paint events
     32    const div2 = document.createElement('div');
     33    div2.setAttribute('containertiming-ignore', '');
     34    div1.appendChild(div2)
     35 
     36    // Add image of width equal to 100 and height equal to 100.
     37    const img = document.createElement('img');
     38    img.src = '/container-timing/resources/square100.png';
     39    img.setAttribute('id', 'img_id');
     40    div2.appendChild(img);
     41 
     42    addPaintingElementTimingAfterDoubleRAF(document.body);
     43  }, 'Paint of the image child of container timing with ignore in the middle is not reported.');
     44 </script>
     45 
     46 </body>