Bug 969506 - TextTrack's ActiveCues should return null of TextTrack's mode is set to 'disabled'. r=rillian

This commit is contained in:
Rick Eyre 2014-02-07 13:59:26 -05:00
Родитель 106bbee041
Коммит 0471b003b2
2 изменённых файлов: 19 добавлений и 5 удалений

Просмотреть файл

@ -148,7 +148,7 @@ TextTrack::RemoveRegion(const TextTrackRegion& aRegion, ErrorResult& aRv)
void
TextTrack::UpdateActiveCueList()
{
if (mMode == TextTrackMode::Disabled || !mTextTrackList) {
if (!mTextTrackList) {
return;
}
@ -188,15 +188,20 @@ TextTrack::UpdateActiveCueList()
TextTrackCueList*
TextTrack::GetActiveCues() {
UpdateActiveCueList();
return mActiveCueList;
if (mMode != TextTrackMode::Disabled) {
UpdateActiveCueList();
return mActiveCueList;
}
return nullptr;
}
void
TextTrack::GetActiveCueArray(nsTArray<nsRefPtr<TextTrackCue> >& aCues)
{
UpdateActiveCueList();
mActiveCueList->GetArray(aCues);
if (mMode != TextTrackMode::Disabled) {
UpdateActiveCueList();
mActiveCueList->GetArray(aCues);
}
}
uint16_t

Просмотреть файл

@ -173,6 +173,15 @@ SpecialPowers.pushPrefEnv({"set": [["media.webvtt.enabled", true]]},
is(cueList.length, 6, "Cue list length should be 6.");
video.currentTime = 2;
isnot(trackElement.track.activeCues, null);
trackElement.track.mode = "disabled";
is(trackElement.track.activeCues, null);
trackElement.track.mode = "showing";
video.currentTime = 0;
// Test TextTrack::ActiveCues.
var cueInfo = [
{ startTime: 0.51, endTime: 0.71, ids: ["Cue 01"] },