Bug 1163223 - Switch test_buffered to use timeupdate rather than loadedmetadata. r=cpearce
authorBobby Holley <bobbyholley@gmail.com>
Thu, 11 Jun 2015 16:04:28 -0700
changeset 249188 8baf29b879aa3b042979c8e7baa30854394808ec
parent 249187 bbeaa22dfafe54b1d15a89092c151d9424c0679f
child 249189 84ab38ab2fac5fb65a0b45881af78499ffe19d90
push id61166
push userbobbyholley@gmail.com
push dateTue, 16 Jun 2015 22:09:02 +0000
treeherdermozilla-inbound@0e80ea297120 [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