|
1 <!DOCTYPE html> |
|
2 <html> |
|
3 <head> |
|
4 <title>Child window at 127.0.0.1</title> |
|
5 <script type="application/javascript"> |
|
6 function run() |
|
7 { |
|
8 var target = document.getElementById("location"); |
|
9 target.textContent = location.hostname + ":" + (location.port || 80); |
|
10 |
|
11 var message = "child-response"; |
|
12 |
|
13 var domain = document.domain; |
|
14 if (domain !== "127.0.0.1") |
|
15 message += " wrong-initial-domain(" + domain + ")"; |
|
16 |
|
17 try |
|
18 { |
|
19 document.domain = "0.0.1"; |
|
20 domain = document.domain; |
|
21 message += " ip-address-shortened-to(" + domain + ")"; |
|
22 } |
|
23 catch (e) |
|
24 { |
|
25 domain = document.domain; |
|
26 if (domain !== "127.0.0.1") |
|
27 message += " ip-address-mutated-on-throw(" + domain + ")"; |
|
28 } |
|
29 |
|
30 window.parent.postMessage(message, "http://mochi.test:8888"); |
|
31 } |
|
32 |
|
33 window.addEventListener("load", run, false); |
|
34 </script> |
|
35 </head> |
|
36 <body> |
|
37 <h1 id="location">Somewhere!</h1> |
|
38 </body> |
|
39 </html> |