summaryrefslogtreecommitdiffstats
path: root/dom/media/test/test_reactivate.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/media/test/test_reactivate.html
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/test/test_reactivate.html')
-rw-r--r--dom/media/test/test_reactivate.html64
1 files changed, 64 insertions, 0 deletions
diff --git a/dom/media/test/test_reactivate.html b/dom/media/test/test_reactivate.html
new file mode 100644
index 0000000000..43675f7771
--- /dev/null
+++ b/dom/media/test/test_reactivate.html
@@ -0,0 +1,64 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test reactivation of a media element from a dead document</title>
+ <script 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 elements;
+
+function playElement(e) {
+ // All elements played out, finish the test case.
+ if (!e) {
+ SimpleTest.finish();
+ return;
+ }
+
+ e.play();
+ info("Element play: " + e._name);
+ var reviveElement = function() {
+ document.body.appendChild(e);
+ e.onended = function() {
+ info("Element ended: " + e._name);
+ removeNodeAndSource(e);
+ // Play next element.
+ playElement(elements.pop());
+ }
+ }
+ setTimeout(reviveElement, 2000);
+}
+
+function loadedAll(elementList) {
+ elements = elementList;
+
+ // Log events for debugging.
+ var events = ["suspend", "play", "canplay", "canplaythrough", "loadstart", "loadedmetadata",
+ "loadeddata", "playing", "ended", "error", "stalled", "emptied", "abort",
+ "waiting", "pause"];
+ function logEvent(e) {
+ info(e.target._name + ": got " + e.type);
+ }
+ elementList.forEach(function(element) {
+ events.forEach(function(evt) {
+ element.addEventListener(evt, logEvent);
+ });
+ });
+
+ // Blow away the subframe
+ document.body.removeChild(document.getElementById("frame"));
+
+ // Play elements one by one to avoid hitting bug 847903 on MacOSX.
+ playElement(elements.pop());
+}
+</script>
+</pre>
+</body>
+</html>