[Release] Webkit-EFL Ver. 2.0_beta_118996_0.6.22
[framework/web/webkit-efl.git] / LayoutTests / fast / events / message-port-constructor-for-deleted-document.html
1 <body>
2 <p>Test that destroying a document doesn't cause a crash when executing MessageChannel constructor saved from its Window object.</p>
3 <pre id=log></pre>
4 <script>
5 function gc()
6 {
7     if (window.GCController)
8         return GCController.collect();
9
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");
12     }
13 }
14
15 function log(message)
16 {
17     document.getElementById("log").innerHTML += message + "<br>";
18 }
19
20 if (window.layoutTestController) {
21     layoutTestController.dumpAsText();
22     layoutTestController.waitUntilDone();
23 }
24
25 var constructor;
26
27 function test()
28 {
29     constructor = window.frames[0].MessageChannel;
30
31     var frameElement = document.getElementsByTagName("iframe")[0];
32     frameElement.parentNode.removeChild(frameElement);
33     frameElement = null;
34
35     gc();
36     setTimeout(test2, 10);
37 }
38
39 function test2()
40 {
41     gc();
42     try {
43         new constructor;
44     } catch (ex) {
45     }
46
47     log("Didn't crash: SUCCESS");
48
49     if (window.layoutTestController)
50         layoutTestController.notifyDone();
51 }
52
53 </script>
54 <iframe src="resources/message-port-iframe.html" onload="test()"></iframe>
55 </body>