From 91c08eabb13a821e345d2a239bbfe89409e1a7cb Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Wed, 12 Jun 2013 22:26:14 -0400 Subject: [PATCH] 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. --- content/media/WebVTTLoadListener.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/content/media/WebVTTLoadListener.cpp b/content/media/WebVTTLoadListener.cpp index 7d652092b88..a754b1b079a 100644 --- a/content/media/WebVTTLoadListener.cpp +++ b/content/media/WebVTTLoadListener.cpp @@ -73,6 +73,7 @@ WebVTTLoadListener::LoadResource() mParser.own(parser); NS_ENSURE_TRUE(mParser != nullptr, NS_ERROR_FAILURE); + mElement->mReadyState = HTMLTrackElement::LOADING; return NS_OK; } @@ -89,6 +90,9 @@ WebVTTLoadListener::OnStopRequest(nsIRequest* aRequest, nsresult aStatus) { webvtt_finish_parsing(mParser); + if(mElement->mReadyState != HTMLTrackElement::ERROR) { + mElement->mReadyState = HTMLTrackElement::LOADED; + } return NS_OK; } @@ -227,6 +231,11 @@ WebVTTLoadListener::OnReportError(uint32_t aLine, uint32_t aCol, #endif 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 // if the return value is negative: case WEBVTT_MALFORMED_TIMESTAMP: