tor-browser

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

invisible-images.js (944B)


      1 async_test(t => {
      2  assert_implements(window.LargestContentfulPaint, "LargestContentfulPaint is not implemented");
      3  const observer = new PerformanceObserver(
      4    t.step_func(entryList => {
      5       entryList.getEntries().forEach(entry => {
      6       // May receive a text entry. Ignore that entry.
      7        if (!entry.url) {
      8          return;
      9        }
     10        // The images should not have caused an entry, so fail test.
     11        assert_unreached('Should not have received an entry! Received one with id '
     12            + entryList.getEntries()[0].id);
     13      });
     14    })
     15  );
     16  observer.observe({type: 'largest-contentful-paint', buffered: true});
     17  // Images have been added but should not cause entries to be dispatched.
     18  // Wait for 500ms and end test, ensuring no entry was created.
     19  t.step_timeout(() => {
     20    t.done();
     21  }, 500);
     22 }, 'Images with opacity: 0, visibility: hidden, or display: none are not observable by LargestContentfulPaint.');