summaryrefslogtreecommitdiffstats
path: root/toolkit/identity/tests/chrome/sandbox_content_perms.html
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/identity/tests/chrome/sandbox_content_perms.html')
-rw-r--r--toolkit/identity/tests/chrome/sandbox_content_perms.html64
1 files changed, 64 insertions, 0 deletions
diff --git a/toolkit/identity/tests/chrome/sandbox_content_perms.html b/toolkit/identity/tests/chrome/sandbox_content_perms.html
new file mode 100644
index 000000000..d24c683f8
--- /dev/null
+++ b/toolkit/identity/tests/chrome/sandbox_content_perms.html
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html>
+ <!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+ <head>
+ <meta charset="utf-8">
+ <title>Page testing content in the Sandbox can't escape</title>
+ <script type="application/javascript;version=1.8">
+ const TEST_BASE = "http://mochi.test:8888/chrome/toolkit/identity/tests/chrome/"
+ const Ci = SpecialPowers.Ci;
+
+ function expectException(aFunc) {
+ try {
+ aFunc();
+ } catch (ex) {
+ return true;
+ }
+ return false;
+ }
+
+ function CcNotPresent() {
+ if (typeof Components === 'undefined')
+ return true;
+ // Components shim doesn't define Components.classes.
+ try {
+ return typeof Components.classes === 'undefined';
+ } catch (e) {
+ return false;
+ }
+ }
+
+ // Build an object with test results (true = pass)
+ let results = {
+ windowTop: window.top == window,
+
+ qiWindow: expectException(function() {
+ let isForced = window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils)
+ .docCharsetIsForced;
+ }),
+
+ ccAccess: !!CcNotPresent(),
+ };
+
+ let resultsJSON = JSON.stringify(results);
+
+ // Send the results to the mochitest server so the test file can retrieve them.
+ let stateURL = TEST_BASE + "sandbox_content.sjs"
+ let xhr = new XMLHttpRequest();
+ xhr.open("GET", stateURL + "?" + encodeURIComponent(resultsJSON), true);
+ xhr.onload = function() {
+ if (xhr.status != 200) {
+ dump("Failed sending results\n");
+ }
+ };
+ xhr.send();
+
+ </script>
+ </head>
+
+ <body>
+
+ </body>
+</html>