tor-browser

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

disconnect-target.html (1298B)


      1 <!DOCTYPE html>
      2 <html>
      3 <meta charset=utf-8 />
      4 <script src=/resources/testharness.js></script>
      5 <script src=/resources/testharnessreport.js></script>
      6 <script src=/resources/testdriver.js></script>
      7 <script src=/resources/testdriver-vendor.js></script>
      8 
      9 <script src=resources/event-timing-test-utils.js></script>
     10 
     11 <button id='the_button'>ClickMe</button>
     12 
     13 <script>
     14 async_test(function(t) {
     15  assert_implements(window.PerformanceEventTiming, 'Event Timing is not supported.');
     16  const observer = new PerformanceObserver(t.step_func_done((entryList) => {
     17    const entries = entryList.getEntries().filter(e => e.name === 'pointerdown');
     18    if (entries.length === 0)
     19      return;
     20    // There must only be one click entry.
     21    assert_equals(entries.length, 1);
     22    const entry = entries[0];
     23    // This checks that entry.target returns the correct button Node.
     24    verifyClickEvent(entry, 'the_button', true);
     25    const button = document.getElementById('the_button');
     26    button.parentNode.removeChild(button);
     27    // After removing the button, entry.target should now return null.
     28    assert_equals(entry.target, null);
     29  }));
     30  observer.observe({entryTypes: ['event']});
     31  clickAndBlockMain('the_button');
     32 }, "Event Timing: when target is disconnected, entry.target returns null.");
     33 </script>
     34 </html>