Bug 1163223 - Switch test_buffered to use timeupdate rather than loadedmetadata. r=cpearce
☠☠ backed out by 3fe20c75349b ☠ ☠
authorBobby Holley <bobbyholley@gmail.com>
Thu, 11 Jun 2015 16:04:28 -0700
changeset 280001 7b6804398fc3aeeea8b61146a88748ce432afc50
parent 280000 f049fcbdfe1e150a50914c68f9caa63061c8dbff
child 280002 aea6b8d1531852ac1a978bafb4107a218b8415d8
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1163223
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1163223 - Switch test_buffered to use timeupdate rather than loadedmetadata. r=cpearce The problem is that we can't compute buffered until we know the start time, but don't necessarily know the start time by the time we fire loadedmetadata (we just know the duration). Chris determined that there was nothing in the spec that requires any particular behavior from .buffered after loadedmetadata, so this should be fine.
dom/media/test/test_buffered.html
--- a/dom/media/test/test_buffered.html
+++ b/dom/media/test/test_buffered.html
@@ -20,16 +20,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <script type="application/javascript">
 
 // Test for Bug 462957; HTMLMediaElement.buffered.
 
 var manager = new MediaTestManager;
 
 function testBuffered(e) {
   var v = e.target;
+  v.removeEventListener('timeupdate', testBuffered);
   
   // The whole media should be buffered...
   var b = v.buffered;
   is(b.length, 1, v._name + ": Should be buffered in one range");
   is(b.start(0), 0, v._name + ": First range start should be media start");
   ok(Math.abs(b.end(0) - v.duration) < 0.1, v._name + ": First range end should be media end");
 
   // Ensure INDEX_SIZE_ERR is thrown when we access outside the range
@@ -89,22 +90,22 @@ function fetch(url, fetched_callback) {
 }
 
 function startTest(test, token) {
   // Fetch the media resource using XHR so we can be sure the entire
   // resource is loaded before we test buffered ranges. This ensures
   // we have deterministic behaviour.
   var onfetched = function(uri) {
     var v = document.createElement('video');
-    v.preload = "metadata";
+    v.autoplay = true;
     v._token = token;
     v.src = uri;
     v._name = test.name;
     v._test = test;
-    v.addEventListener("loadedmetadata", testBuffered, false);
+    v.addEventListener("timeupdate", testBuffered, false);
     document.body.appendChild(v);
   };
 
   manager.started(token);
   fetch(test.name, onfetched);
 }
 
 // Note: No need to set media test prefs, since we're using XHR to fetch