toolkit/identity/tests/chrome/sandbox_content_perms.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   <!-- Any copyright is dedicated to the Public Domain.
     4      - http://creativecommons.org/publicdomain/zero/1.0/ -->
     5   <head>
     6     <meta charset="utf-8">
     7     <title>Page testing content in the Sandbox can't escape</title>
     8     <script type="application/javascript;version=1.8">
     9       const TEST_BASE = "http://mochi.test:8888/chrome/toolkit/identity/tests/chrome/"
    10       const Ci = SpecialPowers.Ci;
    12       function expectException(aFunc) {
    13         try {
    14           aFunc();
    15         } catch (ex) {
    16           return true;
    17         }
    18         return false;
    19       }
    21       function CcNotPresent() {
    22         if (typeof Components === 'undefined')
    23           return true;
    24         // Components shim doesn't define Components.classes.
    25         try {
    26           return typeof Components.classes === 'undefined';
    27         } catch (e) {
    28           return false;
    29         }
    30       }
    32       // Build an object with test results (true = pass)
    33       let results = {
    34         windowTop: window.top == window,
    36         qiWindow: expectException(function() {
    37           let isForced = window.QueryInterface(Ci.nsIInterfaceRequestor)
    38                                .getInterface(Ci.nsIDOMWindowUtils)
    39                                .docCharsetIsForced;
    40         }),
    42         ccAccess: !!CcNotPresent(),
    43       };
    45       let resultsJSON = JSON.stringify(results);
    47       // Send the results to the mochitest server so the test file can retrieve them.
    48       let stateURL = TEST_BASE + "sandbox_content.sjs"
    49       let xhr = new XMLHttpRequest();
    50       xhr.open("GET", stateURL + "?" + encodeURIComponent(resultsJSON), true);
    51       xhr.onload = function() {
    52         if (xhr.status != 200) {
    53           dump("Failed sending results\n");
    54         }
    55       };
    56       xhr.send();
    58     </script>
    59   </head>
    61   <body>
    63   </body>
    64 </html>

mercurial