1526555b29bffedaf9174e2edd34d14a0a9ade90
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / security / javascriptURL / xss-DENIED-to-javascript-url-in-foreign-domain-window-open.html
1 <html>
2 <head>
3     <script src="../resources/cross-frame-access.js"></script>
4     <script>
5         var openedWindow;
6
7         window.onload = function()
8         {
9             if (window.testRunner) {
10                 testRunner.dumpAsText();
11                 testRunner.setCanOpenWindows();
12                 testRunner.waitUntilDone();
13             }
14
15             openedWindow = window.open("http://localhost:8000/security/javascriptURL/resources/foreign-domain-javascript-url-accessee-opened-frame.html");
16
17             if (window.testRunner) {
18                 setTimeout(pollForTest, 1);
19             } else {
20                 log("To run the test, click the button below when the opened window finishes loading.");
21                 var button = document.createElement("button");
22                 button.appendChild(document.createTextNode("Run Test"));
23                 button.onclick = runTest;
24                 document.body.appendChild(button);
25             }
26         }
27
28         pollForTest = function()
29         {
30             if (!testRunner.globalFlag) {
31                 setTimeout(pollForTest, 1);
32                 return;
33             }
34             runTest();
35             closeWindowAndNotifyDone(openedWindow);
36         }
37
38         runTest = function()
39         {
40             try {
41                 openedWindow[0].document.getElementById('accessMe').innerHTML = "FAIL: Cross frame access to a javascript: URL embed in a frame window.open'ed on foreign domain allowed.";
42                 log("FAIL: Cross frame access to a javascript: URL embed in a frame window.open'ed on foreign domain allowed.");
43                 return;
44             } catch (e) {
45             }
46             log("PASS: Cross frame access to a javascript: URL embed in a frame window.open'ed on foreign domain denied!");
47         }
48     </script>
49 </head>
50 <body>
51     <pre id="console"></pre>
52 </body>
53 </html>