tor-browser

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

remove-first.html (1760B)


      1 <!DOCTYPE html>
      2 <title>Remove the first element on the fullscreen element stack</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/resources/testdriver.js"></script>
      6 <script src="/resources/testdriver-vendor.js"></script>
      7 <script src="../trusted-click.js"></script>
      8 <div id="log"></div>
      9 <div id="first">
     10  <div id="last"></div>
     11 </div>
     12 <script>
     13  promise_test(async (t) => {
     14    t.add_cleanup(() => {
     15      if (document.fullscreenElement) {
     16        return document.exitFullscreen();
     17      }
     18    });
     19    const first = document.getElementById("first");
     20 
     21    const [, firstEvent] = await Promise.all([
     22      trusted_request(first),
     23      fullScreenChange(),
     24    ]);
     25    assert_equals(document.fullscreenElement, first, "fullscreen element after first request");
     26    assert_equals(firstEvent.target, first, "first fullscreenchange event target");
     27 
     28    const last = document.getElementById("last");
     29    const [, secondEvent] = await Promise.all([
     30      trusted_request(last),
     31      fullScreenChange(),
     32    ]);
     33    assert_equals(document.fullscreenElement, last, "fullscreen element after second request");
     34    assert_equals(secondEvent.target, last, "second fullscreenchange event target");
     35    first.remove();
     36 
     37    // Both /first/ and /last/ were removed from the top layer and
     38    // thus the fullscreen element synchronously becomes null.
     39    assert_equals(document.fullscreenElement, null, "fullscreen element immediately after removal");
     40 
     41    const thirdEvent = await fullScreenChange();
     42    assert_equals(document.fullscreenElement, null, "fullscreen element after third event");
     43    assert_equals(thirdEvent.target, document, "third fullscreenchange event target");
     44  });
     45 </script>