tor-browser

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

fullscreen-reordering.html (2384B)


      1 <!DOCTYPE html>
      2 <title>Re-requesting fullscreen doesn't fail but doesn't change order</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="/common/top-layer.js"></script>
      8 
      9 <div class="elements">
     10  <div id="A">Element A</div>
     11  <div id="B">Element B</div>
     12 </div>
     13 
     14 <style>
     15  .elements > div {
     16    width: 200px;
     17    height: 200px;
     18  }
     19  #A { background: blue; }
     20  #B { background: green; }
     21 </style>
     22 
     23 <script>
     24 promise_test(async (t) => {
     25  t.add_cleanup(async () => {
     26    while (document.fullscreenElement)
     27      await document.exitFullscreen();
     28  });
     29  document.onfullscreenerror = () => assert_unreached('fullscreenerror should not happen');
     30  const A = document.getElementById('A');
     31  const B = document.getElementById('B');
     32  assert_true(!isTopLayer(A) && !isTopLayer(B));
     33  await blessTopLayer(document.body);
     34  await A.requestFullscreen();
     35  assert_equals(document.fullscreenElement, A, 'first A request');
     36  assert_true(isTopLayer(A), 'A top layer');
     37  await blessTopLayer(A);
     38  try {
     39    await B.requestFullscreen();
     40  } catch (error) {
     41    assert_unreached('The second call to requestFullscreen rejected - it should be possible to put siblings into fullscreen together');
     42  }
     43  assert_equals(document.fullscreenElement, B, 'B request');
     44  assert_true(isTopLayer(B), 'B top layer');
     45  assert_true(isTopLayer(A), 'A still top layer');
     46  await blessTopLayer(B);
     47  await A.requestFullscreen();
     48  assert_true(isTopLayer(A), 'A is still top layer');
     49  assert_true(isTopLayer(B), 'B is still top layer');
     50  assert_equals(document.fullscreenElement, A, 'A is moved back to the top of the top layer stack');
     51  assert_equals(document.elementFromPoint(10, 10), A, 'A should be topmost');
     52 
     53  await document.exitFullscreen();
     54  assert_equals(document.fullscreenElement, B, 'B goes back to being the fullscreen element');
     55  assert_true(isTopLayer(B), 'B is still top layer');
     56  assert_false(isTopLayer(A), 'A is no longer top layer');
     57  await document.exitFullscreen();
     58  assert_equals(document.fullscreenElement, null, 'Both closed');
     59  assert_false(isTopLayer(A), 'A is no longer top layer');
     60  assert_false(isTopLayer(B), 'B is no longer top layer');
     61 }, 'Requesting fullscreen on A, then B, then A');
     62 </script>