tor-browser

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

document-hasfocus.https.html (1288B)


      1 <!DOCTYPE html>
      2 <title>Test document.hasFocus</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/common/utils.js"></script>
      6 <script src="/common/dispatcher/dispatcher.js"></script>
      7 <script src="resources/utils.js"></script>
      8 <script src="/resources/testdriver.js"></script>
      9 <script src="/resources/testdriver-actions.js"></script>
     10 <script src="/resources/testdriver-vendor.js"></script>
     11 
     12 <body>
     13 <script>
     14 promise_test(async(t) => {
     15  const actions = new test_driver.Actions();
     16  const fencedframe = await attachFencedFrameContext();
     17 
     18  assert_true(document.hasFocus(), "The main document should initially have " +
     19      "focus.");
     20  await fencedframe.execute(() => {
     21    assert_false(document.hasFocus(), "The fenced frame should not initially " +
     22        "have focus.");
     23  })
     24 
     25  await actions.pointerMove(0, 0, {origin: fencedframe.element})
     26               .pointerDown()
     27               .pointerUp()
     28               .send();
     29 
     30  assert_true(document.hasFocus(), "The main document should have focus.");
     31  await fencedframe.execute(() => {
     32    assert_true(document.hasFocus(), "The fenced frame should have focus.");
     33  })
     34 }, 'document.hasFocus should be the true when a fenced frame has focus');
     35 
     36 </script>
     37 </body>