blob: a5c9ed18307be690146ecd2c5faa70849474b8e1 [file] [log] [blame]
<!DOCTYPE HTML><!-- webkit-test-runner [ enableModernMediaControls=false ] -->
<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="data:text/html,SUCCESS<script>if (window.testRunner) testRunner.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>