Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <?xml version="1.0"?> |
michael@0 | 2 | <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
michael@0 | 3 | <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?> |
michael@0 | 4 | <!-- |
michael@0 | 5 | Test that "MozEnteredFullscreen" is dispatched to chrome on documents that enter fullscreen. |
michael@0 | 6 | |
michael@0 | 7 | Test Description: |
michael@0 | 8 | |
michael@0 | 9 | This chrome window has a browser. The browser's contentDocument (the "outer document") |
michael@0 | 10 | in turn has an iframe (the "inner document"). |
michael@0 | 11 | |
michael@0 | 12 | We request fullscreen in the outer document, and check that MozEnteredDomFullscreen is |
michael@0 | 13 | dispatched to chrome, targeted at the outer document. |
michael@0 | 14 | |
michael@0 | 15 | Then we request fullscreen in the inner document, and check that MozEnteredDomFullscreen |
michael@0 | 16 | is dispatched to chrome, targeted at the inner document. |
michael@0 | 17 | |
michael@0 | 18 | Then we cancel fullscreen in the inner document, and check that MozEnteredDomFullscreen is |
michael@0 | 19 | dispatched again to chrome, targeted at the outer document. This still happens, since the |
michael@0 | 20 | outer document's domain was never approved for fullscreen. |
michael@0 | 21 | --> |
michael@0 | 22 | <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="start();"> |
michael@0 | 23 | |
michael@0 | 24 | <script type="application/javascript" src="chrome://mochikit/content/chrome-harness.js"></script> |
michael@0 | 25 | <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 26 | <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 27 | <script type="application/javascript"><![CDATA[ |
michael@0 | 28 | |
michael@0 | 29 | function ok(condition, msg) { |
michael@0 | 30 | window.opener.wrappedJSObject.ok(condition, msg); |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | function is(a, b, msg) { |
michael@0 | 34 | window.opener.wrappedJSObject.is(a, b, msg); |
michael@0 | 35 | } |
michael@0 | 36 | |
michael@0 | 37 | var gBrowser = null; |
michael@0 | 38 | var gOuterDoc = null; |
michael@0 | 39 | var gInnerDoc = null; |
michael@0 | 40 | |
michael@0 | 41 | function firstEntry(event) { |
michael@0 | 42 | is(event.target, gOuterDoc, "First MozEnteredDomFullscreen should be targeted at outer doc"); |
michael@0 | 43 | window.removeEventListener("MozEnteredDomFullscreen", firstEntry, false); |
michael@0 | 44 | ok(gOuterDoc.mozFullScreenElement != null, "Outer doc should be in fullscreen"); |
michael@0 | 45 | gInnerDoc = gOuterDoc.getElementById("innerFrame").contentDocument; |
michael@0 | 46 | window.addEventListener("MozEnteredDomFullscreen", secondEntry, false); |
michael@0 | 47 | gInnerDoc.defaultView.focus(); |
michael@0 | 48 | gInnerDoc.body.mozRequestFullScreen(); |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | function secondEntry(event) { |
michael@0 | 52 | is(event.target, gInnerDoc, "Second MozEnteredDomFullscreen should be targeted at inner doc"); |
michael@0 | 53 | ok(gInnerDoc.mozFullScreenElement != null, "Inner doc should be in fullscreen"); |
michael@0 | 54 | window.removeEventListener("MozEnteredDomFullscreen", secondEntry, false); |
michael@0 | 55 | window.addEventListener("MozEnteredDomFullscreen", thirdEntry, false); |
michael@0 | 56 | gInnerDoc.mozCancelFullScreen(); |
michael@0 | 57 | } |
michael@0 | 58 | |
michael@0 | 59 | function thirdEntry(event) { |
michael@0 | 60 | is(event.target, gOuterDoc, "Third MozEnteredDomFullscreen should be targeted at outer doc"); |
michael@0 | 61 | ok(gOuterDoc.mozFullScreenElement != null, "Outer doc return to fullscreen after cancel fullscreen in inner doc"); |
michael@0 | 62 | window.removeEventListener("MozEnteredDomFullscreen", thirdEntry, false); |
michael@0 | 63 | gOuterDoc.mozCancelFullScreen(); |
michael@0 | 64 | window.opener.wrappedJSObject.done(); |
michael@0 | 65 | } |
michael@0 | 66 | |
michael@0 | 67 | function start() { |
michael@0 | 68 | SimpleTest.waitForFocus( |
michael@0 | 69 | function() { |
michael@0 | 70 | gBrowser = document.getElementById("browser"); |
michael@0 | 71 | gOuterDoc = gBrowser.contentDocument; |
michael@0 | 72 | gBrowser.contentWindow.focus(); |
michael@0 | 73 | window.addEventListener("MozEnteredDomFullscreen", firstEntry, false); |
michael@0 | 74 | gOuterDoc.body.mozRequestFullScreen(); |
michael@0 | 75 | }); |
michael@0 | 76 | } |
michael@0 | 77 | |
michael@0 | 78 | ]]> |
michael@0 | 79 | </script> |
michael@0 | 80 | <!-- chrome://mochitests/content/chrome/dom/tests/mochitest/chrome/test_MozEnteredDomFullscreen_event.xul --> |
michael@0 | 81 | <browser type="content" id="browser" width="400" height="400" src="http://mochi.test:8888/tests/dom/tests/mochitest/general/file_MozEnteredDomFullscreen.html"/> |
michael@0 | 82 | |
michael@0 | 83 | </window> |