summaryrefslogtreecommitdiffstats
path: root/dom/origin-trials/tests/mochitest/test_subdomain.html
diff options
context:
space:
mode:
Diffstat (limited to 'dom/origin-trials/tests/mochitest/test_subdomain.html')
-rw-r--r--dom/origin-trials/tests/mochitest/test_subdomain.html28
1 files changed, 28 insertions, 0 deletions
diff --git a/dom/origin-trials/tests/mochitest/test_subdomain.html b/dom/origin-trials/tests/mochitest/test_subdomain.html
new file mode 100644
index 0000000000..3814e1e95b
--- /dev/null
+++ b/dom/origin-trials/tests/mochitest/test_subdomain.html
@@ -0,0 +1,28 @@
+<!doctype html>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<iframe></iframe>
+<script>
+ async function testFrame(file, expectEnabled) {
+ let reply = new Promise(resolve => {
+ window.addEventListener("message", function(e) {
+ resolve(e.data);
+ }, { once: true });
+ });
+
+ let iframe = document.querySelector("iframe");
+ let load = new Promise(resolve => {
+ iframe.addEventListener("load", resolve, { once: true });
+ });
+
+ iframe.src = "https://www.example.com/" + location.pathname.replace("test_subdomain.html", file);
+ info("loading " + iframe.src);
+ await load;
+ let data = await reply;
+ is(data.testTrialInterfaceExposed, expectEnabled);
+ }
+
+ add_task(async function test_subdomain() {
+ await testFrame("file_subdomain_good_frame.html", true);
+ await testFrame("file_subdomain_bad_frame.html", false);
+ });
+</script>