3 <body><pre id=
"console"></pre></body>
6 pre
= document
.getElementById('console');
7 text
= document
.createTextNode(str
+ '\n');
11 function recvMsg1(e
) {
13 window
.removeEventListener("message", recvMsg1
, false);
15 if (window
.testRunner
)
16 testRunner
.interceptPostMessage
= true;
18 window
.addEventListener("message", recvMsg2
, false);
19 window
.postMessage("Message 2", "*");
21 // Ensure that we're intercepting postMessages before the origin check
22 window
.postMessage("Message 3", "http://example.org");
24 if (window
.testRunner
) {
25 // We need to call setTimeout here because we intercept the next event.
26 window
.setTimeout(function() { testRunner
.notifyDone(); });
30 function recvMsg2(e
) {
34 window
.addEventListener("message", recvMsg1
, false);
36 if (window
.testRunner
) {
37 window
.testRunner
.dumpAsText();
38 window
.testRunner
.waitUntilDone();
41 window
.postMessage("Message 1", "*");