bool TextTrackLoader::load(const KURL& url, const String& crossOriginMode)
{
    cancelLoad();

    if (!m_client->shouldLoadCues(this))
        return false;

    ASSERT(m_scriptExecutionContext->isDocument());
    Document* document = toDocument(m_scriptExecutionContext);
    CachedResourceRequest cueRequest(ResourceRequest(document->completeURL(url)));

    if (!crossOriginMode.isNull()) {
        m_crossOriginMode = crossOriginMode;
        StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials;
        updateRequestForAccessControl(cueRequest.mutableResourceRequest(), document->securityOrigin(), allowCredentials);
    } else {
        // Cross-origin resources that are not suitably CORS-enabled may not load.
        if (!document->securityOrigin()->canRequest(url)) {
            corsPolicyPreventedLoad();
            return false;
        }
    }

    CachedResourceLoader* cachedResourceLoader = document->cachedResourceLoader();
    m_cachedCueData = cachedResourceLoader->requestTextTrack(cueRequest);
    if (m_cachedCueData)
        m_cachedCueData->addClient(this);
    
    m_client->cueLoadingStarted(this);
    
    return true;
}
bool TextTrackLoader::load(const URL& url, const String& crossOriginMode, bool isInitiatingElementInUserAgentShadowTree)
{
    cancelLoad();

    ASSERT(is<Document>(m_scriptExecutionContext));
    Document* document = downcast<Document>(m_scriptExecutionContext);

    ResourceLoaderOptions options = CachedResourceLoader::defaultCachedResourceOptions();
    options.contentSecurityPolicyImposition = isInitiatingElementInUserAgentShadowTree ? ContentSecurityPolicyImposition::SkipPolicyCheck : ContentSecurityPolicyImposition::DoPolicyCheck;

    CachedResourceRequest cueRequest(ResourceRequest(document->completeURL(url)), options);

    if (!crossOriginMode.isNull()) {
        m_crossOriginMode = crossOriginMode;
        StoredCredentials allowCredentials = equalLettersIgnoringASCIICase(crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials;
        updateRequestForAccessControl(cueRequest.mutableResourceRequest(), *document->securityOrigin(), allowCredentials);
    } else {
        // Cross-origin resources that are not suitably CORS-enabled may not load.
        if (!document->securityOrigin()->canRequest(url)) {
            corsPolicyPreventedLoad();
            return false;
        }
    }

    m_resource = document->cachedResourceLoader().requestTextTrack(cueRequest);
    if (!m_resource)
        return false;

    m_resource->addClient(this);
    
    return true;
}
Beispiel #3
0
void TextTrackLoader::notifyFinished(CachedResource* resource)
{
    ASSERT(m_resource == resource);

    Document* document = toDocument(m_scriptExecutionContext);
    if (!m_crossOriginMode.isNull()
        && !document->securityOrigin()->canRequest(resource->response().url())
        && !resource->passesAccessControlCheck(document->securityOrigin())) {

        corsPolicyPreventedLoad();
    }

    if (m_state != Failed) {
        processNewCueData(resource);
        if (m_cueParser)
            m_cueParser->fileFinished();
        if (m_state != Failed)
            m_state = resource->errorOccurred() ? Failed : Finished;
    }

    if (!m_cueLoadTimer.isActive())
        m_cueLoadTimer.startOneShot(0);
    
    cancelLoad();
}
Beispiel #4
0
void TextTrackLoader::fileFailedToParse() {
  m_state = Failed;

  if (!m_cueLoadTimer.isActive())
    m_cueLoadTimer.startOneShot(0, BLINK_FROM_HERE);

  cancelLoad();
}
Beispiel #5
0
void TextTrackLoader::fileFailedToParse()
{
    LOG(Media, "TextTrackLoader::fileFailedToParse");

    m_state = Failed;

    if (!m_cueLoadTimer.isActive())
        m_cueLoadTimer.startOneShot(0);

    cancelLoad();
}
Beispiel #6
0
void TextTrackLoader::notifyFinished(Resource* resource) {
  DCHECK_EQ(this->resource(), resource);
  if (m_state != Failed)
    m_state = resource->errorOccurred() ? Failed : Finished;

  if (m_state == Finished && m_cueParser)
    m_cueParser->flush();

  if (!m_cueLoadTimer.isActive())
    m_cueLoadTimer.startOneShot(0, BLINK_FROM_HERE);

  cancelLoad();
}
Beispiel #7
0
void TextTrackLoader::notifyFinished(CachedResource* resource)
{
    ASSERT(m_cachedCueData == resource);

    processNewCueData(resource);

    if (m_state != Failed)
        m_state = resource->errorOccurred() ? Failed : Finished;

    if (!m_cueLoadTimer.isActive())
        m_cueLoadTimer.startOneShot(0);
    
    cancelLoad();
}
void TextTrackLoader::notifyFinished(Resource* resource)
{
    ASSERT(this->resource() == resource);
    if (m_state != Failed)
        m_state = resource->errorOccurred() ? Failed : Finished;

    if (m_state == Finished && m_cueParser)
        m_cueParser->flush();

    if (!m_cueLoadTimer.isActive())
        m_cueLoadTimer.startOneShot(0);

    cancelLoad();
}
bool TextTrackLoader::load(const KURL& url, const AtomicString& crossOriginMode)
{
    cancelLoad();

    FetchRequest cueRequest(ResourceRequest(m_document.completeURL(url)), FetchInitiatorTypeNames::texttrack);

    if (!crossOriginMode.isNull()) {
        cueRequest.setCrossOriginAccessControl(m_document.securityOrigin(), crossOriginMode);
    } else if (!m_document.securityOrigin()->canRequest(url)) {
        // Text track elements without 'crossorigin' set on the parent are "No CORS"; report error if not same-origin.
        corsPolicyPreventedLoad(m_document.securityOrigin(), url);
        return false;
    }

    ResourceFetcher* fetcher = m_document.fetcher();
    setResource(fetcher->fetchRawResource(cueRequest));
    return resource();
}
bool TextTrackLoader::load(const KURL& url, CrossOriginAttributeValue crossOrigin)
{
    cancelLoad();

    FetchRequest cueRequest(ResourceRequest(document().completeURL(url)), FetchInitiatorTypeNames::texttrack);

    if (crossOrigin != CrossOriginAttributeNotSet) {
        cueRequest.setCrossOriginAccessControl(document().securityOrigin(), crossOrigin);
    } else if (!document().securityOrigin()->canRequestNoSuborigin(url)) {
        // Text track elements without 'crossorigin' set on the parent are "No CORS"; report error if not same-origin.
        corsPolicyPreventedLoad(document().securityOrigin(), url);
        return false;
    }

    ResourceFetcher* fetcher = document().fetcher();
    setResource(RawResource::fetchTextTrack(cueRequest, fetcher));
    return resource();
}
Beispiel #11
0
bool TextTrackLoader::load(const KURL& url)
{
    if (!m_client->shouldLoadCues(this))
        return false;
    
    cancelLoad();
    
    ASSERT(m_scriptExecutionContext->isDocument());
    Document* document = static_cast<Document*>(m_scriptExecutionContext);
    
    ResourceRequest cueRequest(document->completeURL(url));
    CachedResourceLoader* cachedResourceLoader = document->cachedResourceLoader();
    m_cachedCueData = static_cast<CachedTextTrack*>(cachedResourceLoader->requestTextTrack(cueRequest));
    if (m_cachedCueData)
        m_cachedCueData->addClient(this);
    
    m_client->cueLoadingStarted(this);
    
    return true;
}
Beispiel #12
0
void TextTrackLoader::notifyFinished(CachedResource* resource)
{
    ASSERT(m_resource == resource);

    Document* document = downcast<Document>(m_scriptExecutionContext);
    if (!m_crossOriginMode.isNull() && !resource->passesSameOriginPolicyCheck(*document->securityOrigin()))
        corsPolicyPreventedLoad();

    if (m_state != Failed) {
        processNewCueData(resource);
        if (m_cueParser)
            m_cueParser->fileFinished();
        if (m_state != Failed)
            m_state = resource->errorOccurred() ? Failed : Finished;
    }

    if (m_state == Finished && m_cueParser)
        m_cueParser->flush();

    if (!m_cueLoadTimer.isActive())
        m_cueLoadTimer.startOneShot(0);
    
    cancelLoad();
}
Beispiel #13
0
KreAuthorListWidget::~KreAuthorListWidget()
{
	cancelLoad();
	delete m_thread;
}