tor-browser

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

toJSON.html (1335B)


      1 <!DOCTYPE HTML>
      2 <meta charset=utf-8>
      3 <title>Largest Contentful Paint: toJSON</title>
      4 <body>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <p>Text!</p>
      8 <script>
      9  async_test(function (t) {
     10    assert_implements(window.LargestContentfulPaint, "LargestContentfulPaint is not implemented");
     11    const observer = new PerformanceObserver(
     12      t.step_func_done(function(entryList) {
     13        const entry = entryList.getEntries()[0];
     14        assert_equals(typeof(entry.toJSON), 'function');
     15        const json = entry.toJSON();
     16        assert_equals(typeof(json), 'object');
     17        const keys = [
     18          // PerformanceEntry
     19          'name',
     20          'entryType',
     21          'startTime',
     22          'duration',
     23          // LargestContentfulPaint
     24          'renderTime',
     25          'loadTime',
     26          'size',
     27          'id',
     28          'url',
     29        ];
     30        for (const key of keys) {
     31          assert_equals(json[key], entry[key],
     32            'LargestContentfulPaint ${key} entry does not match its toJSON value');
     33        }
     34        assert_equals(json['element'], undefined, 'toJSON should not include element');
     35      })
     36    );
     37    observer.observe({type: 'largest-contentful-paint', buffered: true});
     38  }, 'Test toJSON() in LargestContentfulPaint.');
     39 </script>
     40 </body>