tor-browser

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

file_fullscreen-esc-exit.html (1730B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=700764
      5 
      6 Verify that an ESC key press in a subdoc of a full-screen doc causes us to
      7 exit DOM full-screen mode.
      8 
      9 -->
     10 <head>
     11  <title>Test for Bug 700764</title>
     12  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     13  <script src="/tests/SimpleTest/EventUtils.js"></script>
     14  <script type="application/javascript" src="file_fullscreen-utils.js"></script>
     15  <style>
     16  body:fullscreen, div:fullscreen {
     17    background-color: red;
     18  }
     19  </style>
     20 </head>
     21 <body>
     22 
     23 <script type="application/javascript">
     24 
     25 function ok(condition, msg) {
     26  opener.ok(condition, "[esc-exit] " + msg);
     27 }
     28 
     29 function is(a, b, msg) {
     30  opener.is(a, b, "[esc-exit] " + msg);
     31 }
     32 
     33 function finish() {
     34  opener.nextTest();
     35 }
     36 
     37 function fullscreenchange1() {
     38  is(document.fullscreenElement, document.body, "FSE should be doc");
     39  addFullscreenChangeContinuation("exit", fullscreenchange2);
     40  ok(!document.getElementById("subdoc").contentWindow.escKeySent, "Should not yet have sent ESC key press.");
     41  document.getElementById("subdoc").contentWindow.startTest();
     42 }
     43 
     44 function fullscreenchange2() {
     45  ok(document.getElementById("subdoc").contentWindow.escKeySent, "Should have sent ESC key press.");
     46  ok(!document.getElementById("subdoc").contentWindow.escKeyReceived, "ESC key press to exit should not be delivered.");
     47  ok(!document.fullscreenElement, "Should have left full-screen mode on ESC key press");
     48  finish();
     49 }
     50 
     51 function begin() {
     52  addFullscreenChangeContinuation("enter", fullscreenchange1);
     53  document.body.requestFullscreen();
     54 }
     55 
     56 </script>
     57 
     58 <!-- This subframe conducts the test. -->
     59 <iframe id="subdoc" src="file_fullscreen-esc-exit-inner.html"></iframe>
     60 
     61 </pre>
     62 </body>
     63 </html>