Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=633602
5 -->
6 <head>
7 <title>Bug 633602 - file_nestedFullScreen.html</title>
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
9 </script>
10 <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js">
11 </script>
12 <script type="application/javascript" src="pointerlock_utils.js"></script>
13 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
14 </head>
15 <body>
16 <a target="_blank"
17 href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
18 Mozilla Bug 633602
19 </a>
21 <div id="parentDiv">
22 <div id="childDiv"></div>
23 </div>
25 <script type="application/javascript">
26 /*
27 * Test for Bug 633602
28 * Requesting fullscreen on a child element of the element with
29 * the pointer locked should unlock the pointer
30 */
32 SimpleTest.waitForExplicitFinish();
34 var parentDiv = document.getElementById("parentDiv")
35 , childDiv = document.getElementById("childDiv")
36 , parentDivLocked = false
37 , parentDivFullScreen = false
38 , pointerLocked = false;
40 function runTests () {
41 ok(parentDivLocked, "After requesting pointerlock on parentDiv " +
42 "document.mozPointerLockElement should be equal to " +
43 " parentDiv element");
44 isnot(pointerLocked, true, "Requesting fullscreen on " +
45 "childDiv while parentDiv still in fullscreen should " +
46 "unlock the pointer");
47 }
49 document.addEventListener("mozpointerlockchange", function (e) {
50 if (document.mozPointerLockElement === parentDiv) {
51 parentDivLocked = true;
52 childDiv.mozRequestFullScreen();
53 }
54 }, false);
56 document.addEventListener("mozfullscreenchange", function() {
57 if (document.mozFullScreenElement === parentDiv) {
58 if (parentDivFullScreen === true) {
59 document.mozCancelFullScreen();
60 }
61 parentDivFullScreen = true;
62 parentDiv.mozRequestPointerLock();
63 }
64 else if (document.mozFullScreenElement === childDiv) {
65 pointerLocked = !!document.mozPointerLockElement;
66 document.mozCancelFullScreen();
67 }
68 else {
69 runTests();
70 SimpleTest.finish();
71 }
72 }, false);
74 function start() {
75 parentDiv.mozRequestFullScreen();
76 }
77 </script>
78 </body>
79 </html>