<!DOCTYPE HTML>

<html>
    <head>
        <script src=media-file.js></script>

        <script>

            if (window.layoutTestController) {
                layoutTestController.dumpAsText();
                layoutTestController.waitUntilDone();
            }

            function log(msg)
            {
                document.getElementById('console').appendChild(document.createTextNode(msg + "\n"));
            }

            function forceGC()
            {
                if (window.GCController)
                    return GCController.collect();
            
                // Force garbage collection
                for (var ndx = 0; ndx < 99000; ndx++)
                    var str = new String("1234");
            }

            function finish()
            {
                log("EVENT(loadstart) from iframe"); 
                
                forceGC();
                location.href="data:text/html,SUCCESS<script>if (window.layoutTestController) layoutTestController.notifyDone()<" + "/script>";
            }

            function loadstart()
            {
                log("EVENT(loadstart)"); 

                var video = document.getElementsByTagName('video')[0];
                var newVideo = video.cloneNode(true);
                newVideo.addEventListener("loadstart", finish);

                var iframeDocument = document.getElementById("iframe").contentDocument;
                iframeDocument.body.appendChild(newVideo); 
            }

            function start()
            {
                var video = document.getElementsByTagName('video')[0];
                video.addEventListener("loadstart", loadstart);
                video.src = findMediaFile("video", "content/test");
            }
        </script>
    </head>
    <body>
        <iframe id="iframe" width=340 height=260 ></iframe>
        <div id=parent><video id=vid></video></div>
        <p>Tests that we don't crash when moving a video element to a new document.</p>
        <script>start()</script>
        <pre id="console"></pre>
    </body>
</html>


