|
1 <!DOCTYPE html> |
|
2 <html> |
|
3 <head> |
|
4 <title>Username/password page for postMessage tests</title> |
|
5 <script type="application/javascript"> |
|
6 |
|
7 function sendMessage(evt) |
|
8 { |
|
9 var msg = "child-message"; |
|
10 |
|
11 if (evt.origin !== "http://mochi.test:8888") |
|
12 msg += " wrong-origin(" + evt.origin + ")"; |
|
13 if (evt.data !== "parent-message") |
|
14 msg += " wrong-data(" + evt.data + ")"; |
|
15 if (evt.lastEventId !== "") |
|
16 msg += " wrong-lastEventId(" + evt.lastEventId + ")"; |
|
17 if (evt.source !== window.parent) |
|
18 msg += " wrong-source"; |
|
19 |
|
20 // It would be good to guarantee that we've been opened with a userinfo of |
|
21 // "bobhope:password", but Gecko elides that from the content-visible URL, |
|
22 // and I can't find another way to actually detect this programmatically. |
|
23 |
|
24 window.parent.postMessage(msg, "http://mochi.test:8888"); |
|
25 } |
|
26 |
|
27 window.addEventListener("message", sendMessage, false); |
|
28 </script> |
|
29 </head> |
|
30 <body> |
|
31 <p>Kid iframe</p> |
|
32 </body> |
|
33 </html> |
|
34 |