Bug 1128858 - release media element after playing webm in testcases. r=cajbir
authorAlfredo Yang <ayang@mozilla.com>
Tue, 03 Feb 2015 01:05:00 +0100
changeset 244914 de6ab277539a57e3b7a68dc5acbdea57f898dda4
parent 244913 43c5e7fa8f9172660e0ddee69f45c6eb705516ff
child 244915 90797b19453e65ffc1769fd1eaeff33766990039
push id7677
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 18:11:24 +0000
treeherdermozilla-aurora@f531d838c055 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscajbir
bugs1128858
milestone38.0a1
Bug 1128858 - release media element after playing webm in testcases. r=cajbir
dom/media/test/test_bug686942.html
dom/media/test/test_paused_after_ended.html
dom/media/test/test_streams_element_capture.html
--- a/dom/media/test/test_bug686942.html
+++ b/dom/media/test/test_bug686942.html
@@ -18,33 +18,37 @@ https://bugzilla.mozilla.org/show_bug.cg
 if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 2);
 }
 
 var manager = new MediaTestManager;
 
 function onloaded(event) {
   var v = event.target;
+  v.removeEventListener("loadedmetadata", onloaded);
   v.currentTime = v.duration;
   return;
 }
 
 function checkNotPlaying(v) {
   ok(v.currentTime == 0, "Should not be playing after seek to end and back to beginning");
   v._finished = true;
   manager.finished(v.token);
+  removeNodeAndSource(v);
 }
 
 function onseeked(event) {
   var v = event.target;
+  v.removeEventListener("seeked", onseeked);
   setTimeout(function() { checkNotPlaying(v); }, 500);
 }
 
 function onended(event) {
   var v = event.target;
+  v.removeEventListener("ended", onended);
   if (v._finished)
     return;
   v.addEventListener("seeked", onseeked, false);
   v.currentTime = 0;
 }
 
 function startTest(test, token) {
   var v = document.createElement('video');
--- a/dom/media/test/test_paused_after_ended.html
+++ b/dom/media/test/test_paused_after_ended.html
@@ -9,23 +9,26 @@
 <body>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 var manager = new MediaTestManager;
 
 function ended(evt) {
   var v = evt.target;
+  v.removeEventListener("ended", ended);
   is(v.gotPause, true, "We should have received a \"pause\" event.")
   is(v.paused, true, v._name + " must be paused after end");
   manager.finished(v.token);
+  removeNodeAndSource(v);
 }
 
 function pause(evt) {
   var v = evt.target;
+  v.removeEventListener("pause", pause);
   v.gotPause = true;
 }
 
 function startTest(test, token) {
   var v = document.createElement('video');
   v.token = token;
   manager.started(v.token);
   v.src = test.name;
--- a/dom/media/test/test_streams_element_capture.html
+++ b/dom/media/test/test_streams_element_capture.html
@@ -42,16 +42,17 @@ function startTest(test, token) {
     }
     is(vout.readyState, vout.HAVE_CURRENT_DATA, test.name + " checking readyState");
     ok(vout.ended, test.name + " checking playback has ended");
     if (test.type.match(/^video/)) {
       checkDrawImage(vout);
     }
     vout.parentNode.removeChild(vout);
     manager.finished(vout.token);
+    removeNodeAndSource(v);
   }}(test, vout, stream);
   vout.addEventListener("ended", checkEnded, false);
 
   document.body.appendChild(vout);
   v.play();
   vout.play();
 
   // Log events for debugging.