예제 #1
0
CachedCSSStyleSheet* CachedResourceLoader::requestUserCSSStyleSheet(ResourceRequest& request, const String& charset)
{
    KURL url = MemoryCache::removeFragmentIdentifierIfNeeded(request.url());

    if (CachedResource* existing = memoryCache()->resourceForURL(url)) {
        if (existing->type() == CachedResource::CSSStyleSheet)
            return static_cast<CachedCSSStyleSheet*>(existing);
        memoryCache()->remove(existing);
    }
    if (url.string() != request.url())
        request.setURL(url);

    CachedCSSStyleSheet* userSheet = new CachedCSSStyleSheet(request, charset);

    bool inCache = memoryCache()->add(userSheet);
    if (!inCache)
        userSheet->setInCache(true);

    userSheet->load(this, ResourceLoaderOptions(DoNotSendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForCrossOriginCredentials, SkipSecurityCheck));

    if (!inCache)
        userSheet->setInCache(false);

    return userSheet;
}
예제 #2
0
CachedCSSStyleSheet* CachedResourceLoader::requestUserCSSStyleSheet(ResourceRequest& request, const String& charset)
{
    KURL url = MemoryCache::removeFragmentIdentifierIfNeeded(request.url());

    if (CachedResource* existing = memoryCache()->resourceForURL(url)) {
        if (existing->type() == CachedResource::CSSStyleSheet)
            return static_cast<CachedCSSStyleSheet*>(existing);
        memoryCache()->remove(existing);
    }
    if (url.string() != request.url())
        request.setURL(url);

    CachedCSSStyleSheet* userSheet = new CachedCSSStyleSheet(request, charset);
    
    bool inCache = memoryCache()->add(userSheet);
    if (!inCache)
        userSheet->setInCache(true);
    
    userSheet->load(this, /*incremental*/ false, SkipSecurityCheck, /*sendResourceLoadCallbacks*/ false);

    if (!inCache)
        userSheet->setInCache(false);
    
    return userSheet;
}