dom/tests/mochitest/pointerlock/file_removedFromDOM.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/pointerlock/file_removedFromDOM.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,68 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +  <!--
     1.7 +  https://bugzilla.mozilla.org/show_bug.cgi?id=633602
     1.8 +
     1.9 +  Test DOM tree in full screen
    1.10 +  -->
    1.11 +  <head>
    1.12 +    <title>Bug 633602 - file_DOMtree.html</title>
    1.13 +    <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js">
    1.14 +    </script>
    1.15 +    <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
    1.16 +    </script>
    1.17 +    <script type="application/javascript" src="pointerlock_utils.js"></script>
    1.18 +    <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.19 +    <style>
    1.20 +    </style>
    1.21 +  </head>
    1.22 +  <body>
    1.23 +    <a target="_blank"
    1.24 +       href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
    1.25 +      Mozilla Bug 633602
    1.26 +    </a>
    1.27 +    <div id="div"></div>
    1.28 +    <pre id="test">
    1.29 +      <script type="text/javascript">
    1.30 +        /*
    1.31 +         * Test for Bug 633602
    1.32 +         * Checks if pointer is unlocked when element is removed from
    1.33 +         * the DOM Tree
    1.34 +         */
    1.35 +
    1.36 +        SimpleTest.waitForExplicitFinish();
    1.37 +
    1.38 +        var div = document.getElementById("div")
    1.39 +          , removedDOM = false;
    1.40 +
    1.41 +        function runTests() {
    1.42 +          ok(removedDOM, "Pointer should be unlocked when " +
    1.43 +            "an element is removed the DOM Tree");
    1.44 +        }
    1.45 +
    1.46 +        document.addEventListener("mozpointerlockchange", function (e) {
    1.47 +          if (document.mozPointerLockElement === div) {
    1.48 +            document.body.removeChild(div);
    1.49 +            removedDOM = !document.mozPointerLockElement;
    1.50 +            document.mozCancelFullScreen();
    1.51 +          }
    1.52 +
    1.53 +        }, false);
    1.54 +
    1.55 +        document.addEventListener("mozfullscreenchange", function (e) {
    1.56 +          if (document.mozFullScreenElement === div) {
    1.57 +              div.mozRequestPointerLock();
    1.58 +          }
    1.59 +          else {
    1.60 +            runTests();
    1.61 +            SimpleTest.finish();
    1.62 +          }
    1.63 +        }, false);
    1.64 +
    1.65 +        function start() {
    1.66 +          div.mozRequestFullScreen();
    1.67 +        }
    1.68 +      </script>
    1.69 +    </pre>
    1.70 +  </body>
    1.71 +</html>

mercurial