toolkit/identity/tests/chrome/sandbox_content_perms.html

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:93c6932ae36f
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;
11
12 function expectException(aFunc) {
13 try {
14 aFunc();
15 } catch (ex) {
16 return true;
17 }
18 return false;
19 }
20
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 }
31
32 // Build an object with test results (true = pass)
33 let results = {
34 windowTop: window.top == window,
35
36 qiWindow: expectException(function() {
37 let isForced = window.QueryInterface(Ci.nsIInterfaceRequestor)
38 .getInterface(Ci.nsIDOMWindowUtils)
39 .docCharsetIsForced;
40 }),
41
42 ccAccess: !!CcNotPresent(),
43 };
44
45 let resultsJSON = JSON.stringify(results);
46
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();
57
58 </script>
59 </head>
60
61 <body>
62
63 </body>
64 </html>

mercurial