dom/tests/mochitest/pointerlock/file_doubleLock.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=633602
     5 -->
     6 <head>
     7   <title>Bug 633602 - file_doubleLockCallBack.html</title>
     8   <script type="text/javascript"
     9           src="/tests/SimpleTest/SimpleTest.js"></script>
    10   <script type="text/javascript"
    11           src="/tests/SimpleTest/EventUtils.js"></script>
    12   <script type="application/javascript" src="pointerlock_utils.js"></script>
    13   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    14   <style type="text/css">
    15       #test-element { background-color: #94E01B; width:100px; height:100px; }
    16   </style>
    17 </head>
    18 <body>
    19   <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
    20     Mozilla Bug 633602</a>
    21   <div id="div"></div>
    22   <pre id="test">
    23     <script type="text/javascript">
    24       /*
    25        * Test for Bug 633602
    26        * If element requests pointerlock on itself while in pointerlock state
    27        * mozpointerlockchange event should be dispatched
    28        */
    30       SimpleTest.waitForExplicitFinish();
    32       var div = document.getElementById("div")
    33         , numberOfLocks = 0;
    35       function runTests () {
    36         is(numberOfLocks, 2, "Requesting pointer lock on a locked element " +
    37           "should dispatch mozpointerlockchange event");
    38       }
    40       document.addEventListener("mozpointerlockchange", function (e) {
    41         if (document.mozPointerLockElement === div) {
    42           if (numberOfLocks === 2) {
    43             document.mozCancelFullScreen();
    44           }
    45           else {
    46             numberOfLocks++;
    47             div.mozRequestPointerLock();
    48           }
    49         }
    50       }, false);
    52       document.addEventListener("mozfullscreenchange", function (e) {
    53         if (document.mozFullScreenElement === div) {
    54           div.mozRequestPointerLock();
    55         }
    56         else {
    57           runTests();
    58           SimpleTest.finish();
    59         }
    60       }, false);
    62       function start() {
    63         console.log('started');
    64         div.mozRequestFullScreen();
    65       }
    66     </script>
    67   </pre>
    68 </body>
    69 </html>

mercurial