tor-browser

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

retrieve-firstInput.html (1414B)


      1 <!DOCTYPE html>
      2 <html>
      3 <meta charset=utf-8 />
      4 <title>Event Timing: first-input entry should be buffered even without observer</title>
      5 <button id='button'>Generate a 'click' event</button>
      6 <script src=/resources/testharness.js></script>
      7 <script src=/resources/testharnessreport.js></script>
      8 <script src=/resources/testdriver.js></script>
      9 <script src=/resources/testdriver-vendor.js></script>
     10 
     11 <script src=resources/event-timing-test-utils.js></script>
     12 
     13 <script>
     14  async_test(function(t) {
     15    assert_implements(window.PerformanceEventTiming, 'Event Timing is not supported.');
     16    function testEntries() {
     17      // First callback is not ensured to have the entry.
     18      if (performance.getEntriesByType('first-input').length === 0) {
     19        t.step_timeout(testEntries, 10);
     20        return;
     21      }
     22      assert_equals(performance.getEntriesByType('first-input').length, 1,
     23        "There should be a first-input entry in the performance timeline");
     24      const entry = performance.getEntriesByType('first-input')[0];
     25      assert_equals(entry.name, 'pointerdown');
     26      assert_equals(entry.entryType, 'first-input');
     27      assert_greater_than_equal(entry.duration, 104,
     28        "The first input was a long one.");
     29      t.done();
     30    }
     31    clickAndBlockMain('button').then(wait).then(t.step_func(testEntries));
     32  },
     33  "Event Timing: check first-input after onload, observer, click, click."
     34  );
     35 </script>
     36 </html>