Bug 882535 - Set HTMLTrackElement Readiness State during WebVTT Parsing. r=rillian

This patch enables "LOADING", "LOADED" and "ERROR" readiness states to be
applied to the Parent HTMLTrackElement, in order to avoid test flakiness,
and to comply with the HTML5 draft
http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#text-track-readiness-state.
This commit is contained in:
Caitlin Potter 2013-06-12 22:26:14 -04:00
parent bf2b401b0c
commit 91c08eabb1

View File

@ -73,6 +73,7 @@ WebVTTLoadListener::LoadResource()
mParser.own(parser); mParser.own(parser);
NS_ENSURE_TRUE(mParser != nullptr, NS_ERROR_FAILURE); NS_ENSURE_TRUE(mParser != nullptr, NS_ERROR_FAILURE);
mElement->mReadyState = HTMLTrackElement::LOADING;
return NS_OK; return NS_OK;
} }
@ -89,6 +90,9 @@ WebVTTLoadListener::OnStopRequest(nsIRequest* aRequest,
nsresult aStatus) nsresult aStatus)
{ {
webvtt_finish_parsing(mParser); webvtt_finish_parsing(mParser);
if(mElement->mReadyState != HTMLTrackElement::ERROR) {
mElement->mReadyState = HTMLTrackElement::LOADED;
}
return NS_OK; return NS_OK;
} }
@ -227,6 +231,11 @@ WebVTTLoadListener::OnReportError(uint32_t aLine, uint32_t aCol,
#endif #endif
switch(aError) { switch(aError) {
// Non-recoverable errors require us to abort parsing:
case WEBVTT_MALFORMED_TAG:
mElement->mReadyState = HTMLTrackElement::ERROR;
return -1;
// Errors which should result in dropped cues // Errors which should result in dropped cues
// if the return value is negative: // if the return value is negative:
case WEBVTT_MALFORMED_TIMESTAMP: case WEBVTT_MALFORMED_TIMESTAMP: