diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/content/src/nsHTMLMediaElement.cpp
index d27b8b198e5..5ff6bf01a14 100644
--- a/content/html/content/src/nsHTMLMediaElement.cpp
+++ b/content/html/content/src/nsHTMLMediaElement.cpp
@@ -1205,6 +1205,7 @@ void nsHTMLMediaElement::NetworkError()
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"));
}
diff --git a/content/media/video/test/test_bug468190.html b/content/media/video/test/test_bug468190.html
index 5e528140097..5a0ea9d083c 100644
--- a/content/media/video/test/test_bug468190.html
+++ b/content/media/video/test/test_bug468190.html
@@ -43,8 +43,9 @@ function playbackEnded() {
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");
diff --git a/content/media/video/test/test_bug468190_wav.html b/content/media/video/test/test_bug468190_wav.html
index ba87d195615..7faa5de7af1 100644
--- a/content/media/video/test/test_bug468190_wav.html
+++ b/content/media/video/test/test_bug468190_wav.html
@@ -43,8 +43,9 @@ function playbackEnded() {
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");
diff --git a/content/media/video/test/test_ended2.html b/content/media/video/test/test_ended2.html
index d928ab76fcc..2a719b9cf1d 100644
--- a/content/media/video/test/test_ended2.html
+++ b/content/media/video/test/test_ended2.html
@@ -39,8 +39,9 @@ function playbackEnded() {
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");
diff --git a/content/media/video/test/test_wav_ended2.html b/content/media/video/test/test_wav_ended2.html
index ad5515f617e..94d992a0118 100644
--- a/content/media/video/test/test_wav_ended2.html
+++ b/content/media/video/test/test_wav_ended2.html
@@ -40,8 +40,9 @@ function playbackEnded() {
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");