Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 <!--
2 Any copyright is dedicated to the Public Domain.
3 http://creativecommons.org/publicdomain/zero/1.0/
4 -->
5 <html>
6 <head>
7 <title>Indexed Database Test</title>
9 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
12 <script type="text/javascript;version=1.7">
13 const testData = [
14 { host: "http://" + window.location.host, expectedResult: true },
15 { host: "http://example.com", expectedResult: false },
16 { host: "http://sub1.test2.example.org:8000", expectedResult: false },
17 { host: "http://" + window.location.host, expectedResult: true }
18 ];
20 const iframe1Path =
21 window.location.pathname.replace("test_third_party.html",
22 "third_party_iframe1.html");
23 const iframe2URL =
24 "http://" + window.location.host +
25 window.location.pathname.replace("test_third_party.html",
26 "third_party_iframe2.html");
28 let testIndex = 0;
29 let testRunning = false;
31 function iframeLoaded() {
32 let message = { source: "parent", href: iframe2URL };
33 let iframe = document.getElementById("iframe1");
34 iframe.contentWindow.postMessage(message.toSource(), "*");
35 }
37 function setiframe() {
38 let iframe = document.getElementById("iframe1");
40 if (!testRunning) {
41 testRunning = true;
42 iframe.addEventListener("load", iframeLoaded, false);
43 }
45 iframe.src = testData[testIndex].host + iframe1Path;
46 }
48 function messageListener(event) {
49 let message = eval(event.data);
51 is(message.source, "iframe", "Good source");
52 is(message.result, testData[testIndex].expectedResult, "Good result");
54 if (testIndex < testData.length - 1) {
55 testIndex++;
56 setiframe();
57 return;
58 }
60 SimpleTest.finish();
61 }
63 function runTest() {
64 SimpleTest.waitForExplicitFinish();
65 window.addEventListener("message", messageListener, false);
66 setiframe();
67 }
68 </script>
70 </head>
72 <body onload="runTest();">
73 <iframe id="iframe1"></iframe>
74 </body>
76 </html>