void HTMLTrackElement::loadTimerFired(TimerBase*) { DVLOG(TRACK_LOG_LEVEL) << "loadTimerFired"; // 6. [X] Set the text track readiness state to loading. setReadyState(kLoading); // 7. [X] Let URL be the track URL of the track element. KURL url = getNonEmptyURLAttribute(srcAttr); // 8. [X] If the track element's parent is a media element then let CORS mode // be the state of the parent media element's crossorigin content attribute. // Otherwise, let CORS mode be No CORS. const AtomicString& corsMode = mediaElementCrossOriginAttribute(); // 9. End the synchronous section, continuing the remaining steps in parallel. // 10. If URL is not the empty string, perform a potentially CORS-enabled // fetch of URL, with the mode being CORS mode, the origin being the origin of // the track element's node document, and the default origin behaviour set to // fail. if (!canLoadUrl(url)) { didCompleteLoad(Failure); return; } if (url == m_url) { DCHECK(m_loader); switch (m_loader->loadState()) { case TextTrackLoader::Idle: case TextTrackLoader::Loading: // If loading of the resource from this URL is in progress, return // early. break; case TextTrackLoader::Finished: didCompleteLoad(Success); break; case TextTrackLoader::Failed: didCompleteLoad(Failure); break; default: NOTREACHED(); } return; } m_url = url; if (m_loader) m_loader->cancelLoad(); m_loader = TextTrackLoader::create(*this, document()); if (!m_loader->load(m_url, crossOriginAttributeValue(corsMode))) didCompleteLoad(Failure); }
void HTMLTrackElement::loadTimerFired(Timer<HTMLTrackElement>*) { if (!fastHasAttribute(srcAttr)) return; WTF_LOG(Media, "HTMLTrackElement::loadTimerFired"); // 6. Set the text track readiness state to loading. setReadyState(HTMLTrackElement::LOADING); // 7. Let URL be the track URL of the track element. KURL url = getNonEmptyURLAttribute(srcAttr); // 8. If the track element's parent is a media element then let CORS mode be the state of the parent media // element's crossorigin content attribute. Otherwise, let CORS mode be No CORS. if (!canLoadUrl(url)) { didCompleteLoad(HTMLTrackElement::Failure); return; } ensureTrack()->scheduleLoad(url); }