tor-browser

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

remove-dialog-should-unblock-document.html (1056B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <script src="/resources/testdriver.js"></script>
      5 <script src="/resources/testdriver-vendor.js"></script>
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 </head>
      9 <body id="body">
     10    <dialog>
     11        This is a dialog
     12    </dialog>
     13    <input />
     14 <script>
     15 "use strict";
     16 function testFocus(element, expectFocus) {
     17    var focusedElement = null;
     18    element.addEventListener('focus', function() { focusedElement = element; }, false);
     19    element.focus();
     20    var theElement = element;
     21    assert_equals(focusedElement === theElement, expectFocus, element.id);
     22 }
     23 
     24 promise_setup(async function() {
     25    await test_driver.click(document.documentElement);
     26 })
     27 
     28 promise_test(async function() {
     29    var dialog = document.querySelector('dialog');
     30    dialog.showModal();
     31 
     32    var input = document.querySelector('input');
     33    testFocus(input, false);
     34 
     35    dialog.remove();
     36    testFocus(input, true);
     37 }, "Test that removing dialog unblocks the document.");
     38 </script>
     39 </body>
     40 </html>