tor-browser

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

fcp-bg-image-two-steps.html (1102B)


      1 <!DOCTYPE html>
      2 <head>
      3 <title>Performance Paint Timing Test: FCP should fire for background image only when visible</title>
      4 <style>
      5    #main {
      6        width: 100px;
      7        height: 100px;
      8    }
      9 
     10    /* contentful and preFCP classes are defined in test_fcp script. */
     11    #main.preFCP {
     12        visibility: hidden;
     13    }
     14 
     15    #main.contentful,  #main.preFCP {
     16        background-image: url(../resources/circles.png);
     17    }
     18 
     19    #main.contentful {
     20        visibility: visible;
     21    }
     22 </style>
     23 </head>
     24 <body>
     25 <script src="/resources/testharness.js"></script>
     26 <script src="/resources/testharnessreport.js"></script>
     27 <script src="../resources/utils.js"></script>
     28 <div id="main"></div>
     29 <script>
     30    // Load the image into memory first to make sure it's decoded.
     31    function load_image() {
     32      const img = document.createElement("img");
     33      img.src = "../resources/circles.png";
     34 
     35      return new Promise(resolve => {
     36        img.onload = async () => resolve();
     37      });
     38    }
     39 
     40    test_fcp("First contentful paint fires for background image only when visible.", load_image);
     41 </script>
     42 </body>
     43 
     44 </html>