tor-browser

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

interactionid-press-key-as-input.html (1482B)


      1 <!DOCTYPE html>
      2 <html>
      3 <meta charset=utf-8 />
      4 <meta name="timeout" content="long">
      5 <title>Event Timing: interactionId-press-key-as-input.</title>
      6 <textarea id='test'></textarea>
      7 <script src=/resources/testharness.js></script>
      8 <script src=/resources/testharnessreport.js></script>
      9 <script src=/resources/testdriver.js></script>
     10 <script src=/resources/testdriver-actions.js></script>
     11 <script src=/resources/testdriver-vendor.js></script>
     12 <script src=resources/event-timing-test-utils.js></script>
     13 
     14 <script>
     15  let observedEntries = [];
     16  let map = new Map();
     17          const events = ['keydown', 'keyup'];
     18 
     19  async_test(function (t) {
     20    assert_implements(window.PerformanceEventTiming, 'Event Timing is not supported.');
     21 
     22    new PerformanceObserver(t.step_func(entryList => {
     23      observedEntries = observedEntries.concat(entryList.getEntries().filter(filterAndAddToMap(events, map)));
     24 
     25      if (observedEntries.length < 2)
     26        return;
     27 
     28      events.forEach(e => assert_greater_than(map.get(e), 0, 'Should have a non-trivial interactionId for ' + e + ' event'));
     29      assert_equals(map.get('keydown'), map.get('keyup'), 'The keydown and the keyup should have the same interactionId');
     30      assert_equals('t', document.getElementById('test').value);
     31      t.done();
     32    })).observe({ type: "event" });
     33 
     34    addListenersAndPress(document.getElementById('test'), 't', events);
     35  }, "Event Timing: compare event timing interactionId for key press as input.");
     36 </script>
     37 
     38 </html>