OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../../http/tests/inspector/debugger-test.js"></script> |
| 5 <script> |
| 6 |
| 7 function testFunction() |
| 8 { |
| 9 setTimeout(timeout, 0); |
| 10 } |
| 11 |
| 12 function timeout() |
| 13 { |
| 14 window.addEventListener("message", onMessageReceivedInParent, false); |
| 15 postMessageToSelf(); |
| 16 postMessageToFrame("start"); |
| 17 } |
| 18 |
| 19 function onMessageReceivedInParent(e) |
| 20 { |
| 21 debugger; |
| 22 if (/data="start"/.test(e.data || "")) |
| 23 postMessageToFrame("done"); |
| 24 } |
| 25 |
| 26 function postMessageToSelf() |
| 27 { |
| 28 window.postMessage("message to myself", "*"); |
| 29 } |
| 30 |
| 31 function postMessageToFrame(msg) |
| 32 { |
| 33 var iframe = document.getElementById("iframe"); |
| 34 var win = iframe.contentWindow; |
| 35 win.postMessage(msg, "*"); |
| 36 } |
| 37 |
| 38 var test = function() |
| 39 { |
| 40 var totalDebuggerStatements = 5; |
| 41 var maxAsyncCallStackDepth = 4; |
| 42 InspectorTest.runAsyncCallStacksTest(totalDebuggerStatements, maxAsyncCallSt
ackDepth); |
| 43 } |
| 44 |
| 45 </script> |
| 46 </head> |
| 47 |
| 48 <body onload="runTest()"> |
| 49 <p> |
| 50 Tests asynchronous call stacks for window.postMessage. |
| 51 </p> |
| 52 <div><iframe src="resources/post-message-listener.html" |
| 53 id="iframe" width="800" height="100" style="border: 1px solid black;"> |
| 54 </iframe></div> |
| 55 </body> |
| 56 </html> |
OLD | NEW |