Bug 984213 - Since 'preload' defaults to 'none' on b2g, 'loadedmetadata' is not fired and caused timeout. r=cpearce
authorJW Wang <jwwang@mozilla.com>
Mon, 17 Mar 2014 16:54:35 +0800
changeset 192120 2ff6bed4f83e1904c15d4c31fa167fea0c3f818e
parent 192119 edb2d87a71fb0dac3dfd7990aede3e0806201ba7
child 192121 4250871ab8ff3f7eb7a6122746f3bd6bc326c160
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs984213
milestone30.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 984213 - Since 'preload' defaults to 'none' on b2g, 'loadedmetadata' is not fired and caused timeout. r=cpearce
content/media/test/mochitest.ini
content/media/test/test_referer.html
--- a/content/media/test/mochitest.ini
+++ b/content/media/test/mochitest.ini
@@ -375,17 +375,16 @@ skip-if = (buildapp == 'b2g' && (toolkit
 [test_preload_actions.html]
 [test_preload_attribute.html]
 [test_progress.html]
 skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) # b2g-debug(bug 901716 - timeouts) b2g-desktop(bug 901716 - timeouts)
 [test_reactivate.html]
 skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) # b2g-debug(timed out in small-shot.mp3) b2g-desktop(timed out in small-shot.mp3)
 [test_readyState.html]
 [test_referer.html]
-skip-if = buildapp == 'b2g'
 [test_reset_events_async.html]
 [test_replay_metadata.html]
 skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug))
 [test_seek2.html]
 [test_seek_out_of_range.html]
 skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug))
 [test_seekable2.html]
 [test_seekable3.html]
--- a/content/media/test/test_referer.html
+++ b/content/media/test/test_referer.html
@@ -23,44 +23,55 @@ function checkComplete() {
   for (var i=0; i<media.length; ++i) {
     if (!media[i]._complete) {
       return;
     }
   }
 
   SimpleTest.finish();
 }
- 
+
+function removeNode(v) {
+  v.removeEventListener("error", loadError, false);
+  v.removeEventListener("loadedmetadata", loadedMetadata, false);
+  v.remove();
+  v.src = "";
+}
+
 function loadError(evt) {
   // If no referer is sent then the sjs returns an error
   ok(false, "check referer is sent with media request");
   evt.target._complete = true;
   checkComplete();
+  removeNode(evt.target);
 }
 
 function loadedMetadata(evt) {
   // If a referer is sent then the sjs returns a valid media
   ok(true, "check referer is sent with media request");
   evt.target._complete = true;
   checkComplete();
+  removeNode(evt.target);
 }
 
 // Create all media objects.
 for (var i=0; i<gSmallTests.length; ++i) {
   var test = gSmallTests[i];
   var type;
   if (/^video/.test(test.type)) {
     type = "video"
   } else {
     type = "audio";
   }
   var v = document.createElement(type);
   if (!v.canPlayType(test.type)) {
     continue;
   }
+  // ensure metadata is loaded for default preload is none on b2g 
+  v.preload = "metadata";
   v._complete = false;
   v.addEventListener("error", loadError, false);
   v.addEventListener("loadedmetadata", loadedMetadata, false);
   v.src = 'referer.sjs?name=' + test.name + '&type=' + test.type;
   document.body.appendChild(v); // Will start load.
   media.push(v);
 }