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