| OLD | NEW |
| 1 <body> | 1 <body> |
| 2 <p>Test that destroying a frame doesn't cause a crash when posting a message to
a MessagePort it owned.</p> | 2 <p>Test that destroying a frame 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) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 testRunner.waitUntilDone(); | 22 testRunner.waitUntilDone(); |
| 23 } | 23 } |
| 24 | 24 |
| 25 var mainPort; | 25 var mainPort; |
| 26 var frameDoc; | 26 var frameDoc; |
| 27 | 27 |
| 28 function test() | 28 function test() |
| 29 { | 29 { |
| 30 frameDoc = window.frames[0].document; | 30 frameDoc = window.frames[0].document; |
| 31 var channel = new MessageChannel; | 31 var channel = new MessageChannel; |
| 32 window.frames[0].postMessage("msg", [channel.port2], "*"); | 32 window.frames[0].postMessage("msg", "*", [channel.port2]); |
| 33 mainPort = channel.port1; | 33 mainPort = channel.port1; |
| 34 mainPort.start(); | 34 mainPort.start(); |
| 35 | 35 |
| 36 mainPort.postMessage("ping"); | 36 mainPort.postMessage("ping"); |
| 37 mainPort.onmessage = test2; | 37 mainPort.onmessage = test2; |
| 38 } | 38 } |
| 39 | 39 |
| 40 function test2() | 40 function test2() |
| 41 { | 41 { |
| 42 var frameElement = document.getElementsByTagName("iframe")[0]; | 42 var frameElement = document.getElementsByTagName("iframe")[0]; |
| (...skipping 19 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 |