Bug 980622 - Free media element node to release decoder. r=cajbir, a=test-only
authorAlfredo Yang <ayang@mozilla.com>
Tue, 27 Jan 2015 02:27:00 -0500
changeset 249454 ef0750f2be56316bc2aecbe1d692c232afd93c52
parent 249453 f655a983cfc8057529e44de9bc76225993f25cda
child 249455 8af71c5b3b6fd1491960d5711225c97000ec43bc
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscajbir, test-only
bugs980622
milestone37.0a2
Bug 980622 - Free media element node to release decoder. r=cajbir, a=test-only
dom/media/test/test_bug495300.html
--- a/dom/media/test/test_bug495300.html
+++ b/dom/media/test/test_bug495300.html
@@ -23,31 +23,36 @@ function filename(uri) {
 
 function mediaEnded(event) {
   ok(true, "Got expected 'ended' event: " + filename(event.target.currentSrc));
 
   if (event.target._expectedDuration)
     ok(Math.abs(event.target.currentTime - event.target._expectedDuration) < 0.1,
        "currentTime equals duration: " + filename(event.target.currentSrc));
 
+  event.target.removeEventListener("ended", mediaEnded, false);
   manager.finished(event.target.token);
+  removeNodeAndSource(event.target);
+}
+
+function mediaLoadedmetadata(event) {
+  event.target.currentTime = event.target.duration;
+  event.target.removeEventListener("loadedmetadata", mediaLoadedmetadata, false);
 }
 
 function startTest(test, token) {
   var elemType = /^audio/.test(test.type) ? "audio" : "video";
   var v1 = document.createElement(elemType);
   v1.preload = "auto";
 
   v1.src = test.name;
   if (test.duration) {
     v1._expectedDuration = test.duration;
   }
-  v1.addEventListener("loadedmetadata", function (event) {
-    event.target.currentTime = event.target.duration;
-  }, false);
+  v1.addEventListener("loadedmetadata", mediaLoadedmetadata, false);
   v1.addEventListener("ended", mediaEnded, false);
   v1.load();
 
   v1.token = token;
   manager.started(token);
 }
 
 manager.runTests(gSeekTests, startTest);