chromium/third_party/blink/web_tests/media/adopt-node-crash.html

<!DOCTYPE HTML>

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

        <script>

            if (window.testRunner) {
                testRunner.dumpAsText();
                testRunner.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 = "../resources/notify-success.html";
            }

            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 = "content/test.ogv";
            }
        </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>