gecko/content/media/test/test_reactivate.html

55 lines
1.2 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<title>Test reactivation of a media element from a dead document</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<iframe id="frame" src="reactivate_helper.html"></iframe>
<pre id="test">
<script class="testbody" type="text/javascript">
var testsWaiting;
var elements;
function didPlay(event) {
ok(true, "Element ended: " + event.target.currentSrc);
--testsWaiting;
if (testsWaiting == 0) {
SimpleTest.finish();
}
}
function reviveElements() {
// reactivate the elements by moving them to our document
for (var i = 0; i < elements.length; ++i) {
document.body.appendChild(elements[i]);
elements[i].addEventListener("ended", didPlay, false);
}
testsWaiting = elements.length;
}
function loadedAll(elementList) {
elements = elementList;
// Blow away the subframe
document.body.removeChild(document.getElementById("frame"));
// Start the elements playing.
for (var i = 0; i < elements.length; ++i) {
elements[i].play();
}
setTimeout(reviveElements, 2000);
}
</script>
</pre>
</body>
</html>