Bug 1334112 - part2: When changing the readyState to HAVE_FUTURE_DATA and HAVE_ENOUGH_DATA, the texttracks must be loaded. r=jwwang
MozReview-Commit-ID: I7oA3TleAFo
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -5566,16 +5566,24 @@ HTMLMediaElement::UpdateReadyStateIntern
}
if (nextFrameStatus == NEXT_FRAME_UNAVAILABLE_BUFFERING) {
// Force HAVE_CURRENT_DATA when buffering.
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA);
return;
}
+ // TextTracks must be loaded for the HAVE_ENOUGH_DATA and
+ // HAVE_FUTURE_DATA.
+ // So force HAVE_CURRENT_DATA if text tracks not loaded.
+ if (mTextTrackManager && !mTextTrackManager->IsLoaded()) {
+ ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA);
+ return;
+ }
+
if (mDownloadSuspendedByCache && mDecoder && !mDecoder->IsEnded()) {
// The decoder has signaled that the download has been suspended by the
// media cache. So move readyState into HAVE_ENOUGH_DATA, in case there's
// script waiting for a "canplaythrough" event; without this forced
// transition, we will never fire the "canplaythrough" event if the
// media cache is too small, and scripts are bound to fail. Don't force
// this transition if the decoder is in ended state; the readyState
// should remain at HAVE_CURRENT_DATA in this case.