tor-browser

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

focusable-area-in-top-document.html (861B)


      1 <!DOCTYPE html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script src="resources/utils.js"></script>
      5 
      6 <iframe srcdoc="<input><script>document.querySelector('input').focus();</script>"></iframe>
      7 
      8 <script>
      9 'use strict';
     10 
     11 promise_test(async () => {
     12  await waitForLoad(window);
     13  let iframe = document.querySelector('iframe');
     14  assert_equals(document.activeElement, iframe, 'Prereq: IFRAME should be focused');
     15 
     16  let input = document.createElement('input');
     17  input.autofocus = true;
     18  document.body.appendChild(input);
     19 
     20  await waitUntilStableAutofocusState();
     21  assert_equals(document.activeElement, iframe, 'activeElement should not be changed');
     22  assert_not_equals(document.activeElement, input);
     23 }, 'If topDocument\'s focused area is not topDocument, autofocus is not processed.');
     24 </script>