OLD | NEW |
1 <body> | 1 <body> |
2 <p>Test that destroying a document doesn't cause a crash when posting a message
to a MessagePort it owned.</p> | 2 <p>Test that destroying a document doesn't cause a crash when posting a message
to a MessagePort it owned.</p> |
3 <pre id=log></pre> | 3 <pre id=log></pre> |
4 <script> | 4 <script> |
5 function gc() | 5 function gc() |
6 { | 6 { |
7 if (window.GCController) | 7 if (window.GCController) |
8 return GCController.collect(); | 8 return GCController.collect(); |
9 | 9 |
10 for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires
about 9K allocations before a collect) | 10 for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires
about 9K allocations before a collect) |
11 var s = new String("abc"); | 11 var s = new String("abc"); |
12 } | 12 } |
13 } | 13 } |
14 | 14 |
15 function log(message) | 15 function log(message) |
16 { | 16 { |
17 document.getElementById("log").innerHTML += message + "<br>"; | 17 document.getElementById("log").innerHTML += message + "<br>"; |
18 } | 18 } |
19 | 19 |
20 if (window.testRunner) { | 20 if (window.testRunner) { |
21 testRunner.dumpAsText(); | 21 testRunner.dumpAsText(); |
22 testRunner.waitUntilDone(); | 22 testRunner.waitUntilDone(); |
23 } | 23 } |
24 | 24 |
25 var mainPort; | 25 var mainPort; |
26 | 26 |
27 function test() | 27 function test() |
28 { | 28 { |
29 var channel = new MessageChannel; | 29 var channel = new MessageChannel; |
30 window.frames[0].postMessage("msg", [channel.port2], "*"); | 30 window.frames[0].postMessage("msg", "*", [channel.port2]); |
31 mainPort = channel.port1; | 31 mainPort = channel.port1; |
32 mainPort.start(); | 32 mainPort.start(); |
33 | 33 |
34 mainPort.postMessage("ping"); | 34 mainPort.postMessage("ping"); |
35 mainPort.onmessage = test2; | 35 mainPort.onmessage = test2; |
36 } | 36 } |
37 | 37 |
38 function test2() | 38 function test2() |
39 { | 39 { |
40 var frameElement = document.getElementsByTagName("iframe")[0]; | 40 var frameElement = document.getElementsByTagName("iframe")[0]; |
(...skipping 21 matching lines...) Expand all Loading... |
62 | 62 |
63 log("Didn't crash: SUCCESS"); | 63 log("Didn't crash: SUCCESS"); |
64 | 64 |
65 if (window.testRunner) | 65 if (window.testRunner) |
66 testRunner.notifyDone(); | 66 testRunner.notifyDone(); |
67 } | 67 } |
68 | 68 |
69 </script> | 69 </script> |
70 <iframe src="resources/message-port-iframe.html" onload="test()"></iframe> | 70 <iframe src="resources/message-port-iframe.html" onload="test()"></iframe> |
71 </body> | 71 </body> |
OLD | NEW |