Bug 488287. When playback ends, readyState should change to HAVE_CURRENT_DATA. r=doublec,sr=roc

--HG--
extra : rebase_source : ea224af1634304c40d7e4ea0f564e72ccab65caa
This commit is contained in:
Matthew Gregan 2009-05-08 14:25:13 +12:00
parent 96c6c7a7fe
commit 016153f95a
5 changed files with 9 additions and 4 deletions

View File

@ -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"));
}

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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");