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.

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

mercurial