tor-browser

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

inert-with-fullscreen-element.html (2078B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8" />
      3 <title>Interaction of 'inert' attribute with fullscreen element</title>
      4 <link rel="author" title="Peng Zhou" href="mailto:zhoupeng.1996@bytedance.com">
      5 <meta name="assert" content="Checks that fullscreen element inertness from ancestors.">
      6 <div id="wrapper">
      7  wrapper
      8  <span>
      9    wrapper-child element
     10  </span>
     11  <div id="fullscreen">
     12    fullscreen
     13    <span id="child">
     14      child
     15    </span>
     16  </div>
     17 </div>
     18 <script src="/resources/testharness.js"></script>
     19 <script src="/resources/testharnessreport.js"></script>
     20 <script src="/resources/testdriver.js"></script>
     21 <script src="/resources/testdriver-vendor.js"></script>
     22 <script>
     23 async function cleanup() {
     24  if (document.fullscreenElement) {
     25    await document.exitFullscreen();
     26  }
     27  getSelection().removeAllRanges();
     28 }
     29 
     30 async function setupTest(element, context) {
     31  element.inert = true;
     32  await test_driver.bless("request full screen");
     33  await fullscreen.requestFullscreen();
     34  context.add_cleanup(async () => {
     35    element.inert = false;
     36    await cleanup();
     37  });
     38 }
     39 
     40 add_completion_callback(cleanup);
     41 
     42 promise_test(async function() {
     43  await setupTest(child, this);
     44  assert_false(window.find("wrapper"));
     45  assert_false(window.find("wrapper-child"));
     46  assert_true(window.find("fullscreen"));
     47  assert_false(window.find("child"));
     48 }, "Inner nodes with 'inert' attribute become inert anyways");
     49 
     50 promise_test(async function() {
     51  await setupTest(fullscreen, this);
     52  assert_false(window.find("wrapper"));
     53  assert_false(window.find("wrapper-child"));
     54  assert_false(window.find("fullscreen"));
     55  assert_false(window.find("child"));
     56 }, "If the fullscreen element has the 'inert' attribute, everything becomes inert");
     57 
     58 promise_test(async function() {
     59  await setupTest(wrapper, this);
     60  assert_false(window.find("wrapper"));
     61  assert_false(window.find("wrapper-child"));
     62  assert_true(window.find("fullscreen"));
     63  assert_true(window.find("child"));
     64 }, "If an ancestor of the fullscreen element has the 'inert' attribute, the fullscreen element escapes inertness");
     65 </script>