| Index: chrome_frame/test/data/postmessage_basic_host.html
|
| ===================================================================
|
| --- chrome_frame/test/data/postmessage_basic_host.html (revision 0)
|
| +++ chrome_frame/test/data/postmessage_basic_host.html (revision 0)
|
| @@ -0,0 +1,69 @@
|
| +<!-- saved from url=(0014)about:internet -->
|
| +<html>
|
| +<!-- This page is meant to load inside the host browser like IE/FF -->
|
| + <head>
|
| + <script type="text/javascript" src="chrome_frame_tester_helpers.js">
|
| + </script>
|
| + <script type="text/javascript">
|
| + var post_message_reply_received = 0;
|
| +
|
| + function onChromeFrameLoaded() {
|
| + appendStatus('Chrome frame loaded...');
|
| + document.ChromeFrame.postMessage('Hello from host');
|
| + setTimeout(onPostMessageFailure, 10000);
|
| + }
|
| +
|
| + function onNavigationFailed(msg) {
|
| + onFailure('PostMessage', 1, 'ChromeFrame Navigation failed: ' + msg);
|
| + }
|
| +
|
| + function onChromeFrameMessage(evt) {
|
| + try {
|
| + var d = new String(evt.data);
|
| + appendStatus('Message: ' + d);
|
| + if (d == 'Hello from ChromeFrame') {
|
| + post_message_reply_received = 1;
|
| + onSuccess('PostMessage', 1);
|
| + } else {
|
| + onFailure('PostMessage', 1, 'unexpected data');
|
| + }
|
| + } catch (e) {
|
| + onFailure('PostMessage', 1, 'exception in onChromeFrameMessage');
|
| + }
|
| + }
|
| +
|
| + function onPostMessageFailure() {
|
| + if (!post_message_reply_received) {
|
| + onFailure('PostMessage', 1, 'Did not receive reply back from frame');
|
| + }
|
| + }
|
| + </script>
|
| + </head>
|
| +
|
| + <body>
|
| + <object id="ChromeFrame" width="500" height ="300"
|
| + codebase="http://www.google.com"
|
| + classid="CLSID:E0A900DF-9611-4446-86BD-4B1D47E7DB2A">
|
| + <param name="src" value="postmessage_basic_frame.html">
|
| + <param name="onload" value="onChromeFrameLoaded();">
|
| + <param name="onloaderror" value="onNavigationFailed();">
|
| + <param name="onmessage" value="onChromeFrameMessage(arguments[0]);">
|
| + <embed id="ChromeFramePlugin" name="ChromeFrame"
|
| + width="500" height="500"
|
| + src="postmessage_basic_frame.html"
|
| + type="application/chromeframe"
|
| + onload="onChromeFrameLoaded();"
|
| + onloaderror="onNavigationFailed();"
|
| + onmessage="onChromeFrameMessage(arguments[0]);">
|
| + </embed>
|
| + </object>
|
| + <br>
|
| + <br>
|
| + <p>Test for PostMessage from the host browser to ChromeFrame and back</p>
|
| + <button onclick="document.ChromeFrame.postMessage('Message from button');">
|
| + Send message to frame</button>
|
| + <div id="statusPanel" style="border: 1px solid red; width: 100%">
|
| + Test running....
|
| + </div>
|
| + </body>
|
| +</html>
|
|
|