Add new access object callback
[framework/web/webkit-efl.git] / LayoutTests / media / adopt-node-crash.html
1 <!DOCTYPE HTML>
2
3 <html>
4     <head>
5         <script src=media-file.js></script>
6
7         <script>
8
9             if (window.testRunner) {
10                 testRunner.dumpAsText();
11                 testRunner.waitUntilDone();
12             }
13
14             function log(msg)
15             {
16                 document.getElementById('console').appendChild(document.createTextNode(msg + "\n"));
17             }
18
19             function forceGC()
20             {
21                 if (window.GCController)
22                     return GCController.collect();
23             
24                 // Force garbage collection
25                 for (var ndx = 0; ndx < 99000; ndx++)
26                     var str = new String("1234");
27             }
28
29             function finish()
30             {
31                 log("EVENT(loadstart) from iframe"); 
32                 
33                 forceGC();
34                 location.href="data:text/html,SUCCESS<script>if (window.testRunner) testRunner.notifyDone()<" + "/script>";
35             }
36
37             function loadstart()
38             {
39                 log("EVENT(loadstart)"); 
40
41                 var video = document.getElementsByTagName('video')[0];
42                 var newVideo = video.cloneNode(true);
43                 newVideo.addEventListener("loadstart", finish);
44
45                 var iframeDocument = document.getElementById("iframe").contentDocument;
46                 iframeDocument.body.appendChild(newVideo); 
47             }
48
49             function start()
50             {
51                 var video = document.getElementsByTagName('video')[0];
52                 video.addEventListener("loadstart", loadstart);
53                 video.src = findMediaFile("video", "content/test");
54             }
55         </script>
56     </head>
57     <body>
58         <iframe id="iframe" width=340 height=260 ></iframe>
59         <div id=parent><video id=vid></video></div>
60         <p>Tests that we don't crash when moving a video element to a new document.</p>
61         <script>start()</script>
62         <pre id="console"></pre>
63     </body>
64 </html>
65
66