OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <html> | |
3 <body><pre id="console"></pre></body> | |
4 <script> | |
5 function write(str) { | |
6 pre = document.getElementById('console'); | |
7 text = document.createTextNode(str + '\n'); | |
8 pre.appendChild(text); | |
9 } | |
10 | |
11 function recvMsg1(e) { | |
12 write("RECV1"); | |
13 window.removeEventListener("message", recvMsg1, false); | |
14 | |
15 if (window.testRunner) | |
16 testRunner.interceptPostMessage = true; | |
17 | |
18 window.addEventListener("message", recvMsg2, false); | |
19 window.postMessage("Message 2", "*"); | |
20 | |
21 // Ensure that we're intercepting postMessages before the origin check | |
22 window.postMessage("Message 3", "http://example.org"); | |
23 | |
24 if (window.testRunner) { | |
25 // We need to call setTimeout here because we intercept the next event. | |
26 window.setTimeout(function() { testRunner.notifyDone(); }); | |
27 } | |
28 } | |
29 | |
30 function recvMsg2(e) { | |
31 write("RECV2"); | |
32 } | |
33 | |
34 window.addEventListener("message", recvMsg1, false); | |
35 | |
36 if (window.testRunner) { | |
37 window.testRunner.dumpAsText(); | |
38 window.testRunner.waitUntilDone(); | |
39 } | |
40 | |
41 window.postMessage("Message 1", "*"); | |
42 </script> | |
43 </html> | |
alexmos
2016/05/13 21:30:07
Wow, I had no idea this test even existed.
| |
44 | |
OLD | NEW |