Bug 488287. When playback ends, readyState should change to HAVE_CURRENT_DATA. r=doublec,sr=roc
authorMatthew Gregan <kinetik@flim.org>
Fri, 08 May 2009 14:25:13 +1200
changeset 28112 4aa17bf8dcdae7a64ae4256cffdf9e87558a8cc6
parent 28111 24793a90135db0a0f492f4a6692219b9c387fe40
child 28113 665b73eb15c804b90b4978b7820e41067a955d59
push id6896
push userrocallahan@mozilla.com
push dateFri, 08 May 2009 03:22:56 +0000
treeherdermozilla-central@c97e93f23f89 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdoublec, roc
bugs488287
milestone1.9.2a1pre
Bug 488287. When playback ends, readyState should change to HAVE_CURRENT_DATA. r=doublec,sr=roc
content/html/content/src/nsHTMLMediaElement.cpp
content/media/video/test/test_bug468190.html
content/media/video/test/test_bug468190_wav.html
content/media/video/test/test_ended2.html
content/media/video/test/test_wav_ended2.html
--- a/content/html/content/src/nsHTMLMediaElement.cpp
+++ b/content/html/content/src/nsHTMLMediaElement.cpp
@@ -1200,16 +1200,17 @@ void nsHTMLMediaElement::NetworkError()
   mNetworkState = nsIDOMHTMLMediaElement::NETWORK_EMPTY;
   DispatchAsyncSimpleEvent(NS_LITERAL_STRING("emptied"));
   ChangeDelayLoadStatus(PR_FALSE);
 }
 
 void nsHTMLMediaElement::PlaybackEnded()
 {
   NS_ASSERTION(mDecoder->IsEnded(), "Decoder fired ended, but not in ended state");
+  ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA);
   DispatchAsyncSimpleEvent(NS_LITERAL_STRING("ended"));
 }
 
 void nsHTMLMediaElement::SeekStarted()
 {
   DispatchAsyncSimpleEvent(NS_LITERAL_STRING("seeking"));
 }
 
--- a/content/media/video/test/test_bug468190.html
+++ b/content/media/video/test/test_bug468190.html
@@ -38,18 +38,19 @@ function playbackEnded() {
   if (completed)
     return false
 
   endCount++;
   var v = document.getElementById('v');
   ok(v.currentTime >= 3.9 && v.currentTime <= 4.0,
      "Checking currentTime at end: " + v.currentTime);
   ok(v.ended, "Checking playback has ended");
+  ok(playingCount > 0, "Expect at least one playing event");
+  playingCount = 0;
   if (endCount < 2) {
-    ok(playingCount > 0, "Expect at least one playing event");
     v.currentTime = 0;
     ok(v.seeking, "Checking that seeking is now true");
     ok(!v.ended, "Checking ended is no longer set as seeking has begun");
     v.play();
   } else {
     ok(endCount == 2, "Check playback after ended event");
     completed = true;
     SimpleTest.finish();
--- a/content/media/video/test/test_bug468190_wav.html
+++ b/content/media/video/test/test_bug468190_wav.html
@@ -38,18 +38,19 @@ function playbackEnded() {
   if (completed)
     return false
 
   endCount++;
   var v = document.getElementById('v');
   ok(v.currentTime >= 0.9 && v.currentTime <= 1.1,
      "Checking currentTime at end: " + v.currentTime);
   ok(v.ended, "Checking playback has ended");
+  ok(playingCount > 0, "Expect at least one playing event");
+  playingCount = 0;
   if (endCount < 2) {
-    ok(playingCount > 0, "Expect at least one playing event");
     v.currentTime = 0;
     ok(v.seeking, "Checking that seeking is now true");
     ok(!v.ended, "Checking ended is no longer set as seeking has begun");
     v.play();
   } else {
     ok(endCount == 2, "Check playback after ended event");
     completed = true;
     SimpleTest.finish();
--- a/content/media/video/test/test_ended2.html
+++ b/content/media/video/test/test_ended2.html
@@ -34,18 +34,19 @@ function playbackEnded() {
   if (completed)
     return false
 
   endCount++;
   var v = document.getElementById('v');
   ok(v.currentTime >= 3.9 && v.currentTime <= 4.0,
      "Checking currentTime at end: " + v.currentTime);
   ok(v.ended, "Checking playback has ended");
+  ok(playingCount > 0, "Expect at least one playing event");
+  playingCount = 0;
   if (endCount < 2) {
-    ok(playingCount > 0, "Expect at least one playing event");
     v.play();
   } else {
     ok(endCount == 2, "Check playback after ended event");
     completed = true;
     SimpleTest.finish();
   }
   return false;
 }
--- a/content/media/video/test/test_wav_ended2.html
+++ b/content/media/video/test/test_wav_ended2.html
@@ -35,18 +35,19 @@ function playbackEnded() {
   if (completed)
     return false
 
   endCount++;
   var v = document.getElementById('v');
   ok(v.currentTime >= 0.9 && v.currentTime <= 1.1,
      "Checking currentTime at end: " + v.currentTime);
   ok(v.ended, "Checking playback has ended");
+  ok(playingCount > 0, "Expect at least one playing event");
+  playingCount = 0;
   if (endCount < 2) {
-    ok(playingCount > 0, "Expect at least one playing event");
     v.play();
   } else {
     ok(endCount == 2, "Check playback after ended event");
     completed = true;
     SimpleTest.finish();
   }
   return false;
 }