dom/tests/mochitest/chrome/test_MozEnteredDomFullscreen_event.xul

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.

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 "MozShowFullScreenWarning" is dispatched to chrome on restricted keypress.
michael@0 6 -->
michael@0 7 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" width="400" height="400">
michael@0 8
michael@0 9 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
michael@0 10
michael@0 11 <script>
michael@0 12 SimpleTest.waitForExplicitFinish();
michael@0 13
michael@0 14 // Ensure the full-screen api is enabled, and will be disabled on test exit.
michael@0 15 var gPrevEnabled = SpecialPowers.getBoolPref("full-screen-api.enabled");
michael@0 16 SpecialPowers.setBoolPref("full-screen-api.enabled", true);
michael@0 17
michael@0 18 var gPrevTrusted = SpecialPowers.getBoolPref("full-screen-api.allow-trusted-requests-only");
michael@0 19 SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", false);
michael@0 20
michael@0 21 const Cc = Components.classes;
michael@0 22 const Ci = Components.interfaces;
michael@0 23
michael@0 24 function make_uri(url) {
michael@0 25 var ios = Cc["@mozilla.org/network/io-service;1"].
michael@0 26 getService(Ci.nsIIOService);
michael@0 27 return ios.newURI(url, null, null);
michael@0 28 }
michael@0 29
michael@0 30 // Ensure "fullscreen" permissions are not present on the test URI.
michael@0 31 var pm = Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager);
michael@0 32 var uri = make_uri("http://mochi.test:8888");
michael@0 33 var principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
michael@0 34 .getService(Ci.nsIScriptSecurityManager)
michael@0 35 .getNoAppCodebasePrincipal(uri);
michael@0 36 pm.removeFromPrincipal(principal, "fullscreen");
michael@0 37
michael@0 38 newwindow = window.open("MozEnteredDomFullscreen_chrome.xul", "_blank","chrome,resizable=yes,width=400,height=400");
michael@0 39
michael@0 40 function done()
michael@0 41 {
michael@0 42 newwindow.close();
michael@0 43 SpecialPowers.setBoolPref("full-screen-api.enabled", gPrevEnabled);
michael@0 44 SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", gPrevTrusted);
michael@0 45 SimpleTest.finish();
michael@0 46 }
michael@0 47
michael@0 48 </script>
michael@0 49
michael@0 50 <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
michael@0 51
michael@0 52 </window>

mercurial