Title: [195770] trunk/Source/WebCore
Revision
195770
Author
[email protected]
Date
2016-01-28 11:52:57 -0800 (Thu, 28 Jan 2016)

Log Message

Allow CachedResourceLoader clients to opt out of the MemoryCache.
https://bugs.webkit.org/show_bug.cgi?id=153549

Reviewed by Darin Adler.

Add a flag to ResourceLoaderOptions which allow loader clients to opt out of having
resources stored in the MemoryCache.

* loader/ResourceLoaderOptions.h:
(WebCore::ResourceLoaderOptions::ResourceLoaderOptions):
(WebCore::ResourceLoaderOptions::cachingPolicy):

Existing clients will have to add the (default) AllowCaching flag when they create a
ResourceLoaderOptions object.

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::startLoadingMainResource):
* loader/MediaResourceLoader.cpp:
(WebCore::MediaResourceLoader::start):
* loader/NetscapePlugInStreamLoader.cpp:
(WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader):
(WebCore::ResourceLoaderOptions::setCachingPolicy):
* loader/icon/IconLoader.cpp:
(WebCore::IconLoader::startLoading):
* platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
(WebCore::WebCoreAVFResourceLoader::startLoading):

Every time the CachedResource or CachedResourceLoader accesses the MemoryCache, check
to see whether the resource or the request have allowed caching before adding resources
to, removing resources from, or sourcing resource data from the MemoryCache.

* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::~CachedResource):
(WebCore::CachedResource::failBeforeStarting):
(WebCore::CachedResource::addClientToSet):
(WebCore::CachedResource::removeClient):
(WebCore::CachedResource::setDecodedSize):
(WebCore::CachedResource::setEncodedSize):
(WebCore::CachedResource::didAccessDecodedData):
* loader/cache/CachedResource.h:
(WebCore::CachedResource::allowsCaching):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
(WebCore::CachedResourceLoader::requestResource):
(WebCore::CachedResourceLoader::revalidateResource):
(WebCore::CachedResourceLoader::loadResource):
(WebCore::CachedResourceLoader::printPreloadStats):
(WebCore::CachedResourceLoader::defaultCachedResourceOptions):
* loader/cache/CachedResourceRequest.h:
(WebCore::CachedResourceRequest::allowsCaching):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (195769 => 195770)


--- trunk/Source/WebCore/ChangeLog	2016-01-28 19:40:36 UTC (rev 195769)
+++ trunk/Source/WebCore/ChangeLog	2016-01-28 19:52:57 UTC (rev 195770)
@@ -1,3 +1,56 @@
+2016-01-27  Jer Noble  <[email protected]>
+
+        Allow CachedResourceLoader clients to opt out of the MemoryCache.
+        https://bugs.webkit.org/show_bug.cgi?id=153549
+
+        Reviewed by Darin Adler.
+
+        Add a flag to ResourceLoaderOptions which allow loader clients to opt out of having
+        resources stored in the MemoryCache. 
+
+        * loader/ResourceLoaderOptions.h:
+        (WebCore::ResourceLoaderOptions::ResourceLoaderOptions):
+        (WebCore::ResourceLoaderOptions::cachingPolicy):
+
+        Existing clients will have to add the (default) AllowCaching flag when they create a
+        ResourceLoaderOptions object.
+
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::startLoadingMainResource):
+        * loader/MediaResourceLoader.cpp:
+        (WebCore::MediaResourceLoader::start):
+        * loader/NetscapePlugInStreamLoader.cpp:
+        (WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader):
+        (WebCore::ResourceLoaderOptions::setCachingPolicy):
+        * loader/icon/IconLoader.cpp:
+        (WebCore::IconLoader::startLoading):
+        * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
+        (WebCore::WebCoreAVFResourceLoader::startLoading):
+
+        Every time the CachedResource or CachedResourceLoader accesses the MemoryCache, check
+        to see whether the resource or the request have allowed caching before adding resources
+        to, removing resources from, or sourcing resource data from the MemoryCache.
+
+        * loader/cache/CachedResource.cpp:
+        (WebCore::CachedResource::~CachedResource):
+        (WebCore::CachedResource::failBeforeStarting):
+        (WebCore::CachedResource::addClientToSet):
+        (WebCore::CachedResource::removeClient):
+        (WebCore::CachedResource::setDecodedSize):
+        (WebCore::CachedResource::setEncodedSize):
+        (WebCore::CachedResource::didAccessDecodedData):
+        * loader/cache/CachedResource.h:
+        (WebCore::CachedResource::allowsCaching):
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
+        (WebCore::CachedResourceLoader::requestResource):
+        (WebCore::CachedResourceLoader::revalidateResource):
+        (WebCore::CachedResourceLoader::loadResource):
+        (WebCore::CachedResourceLoader::printPreloadStats):
+        (WebCore::CachedResourceLoader::defaultCachedResourceOptions):
+        * loader/cache/CachedResourceRequest.h:
+        (WebCore::CachedResourceRequest::allowsCaching):
+
 2016-01-28  Enrica Casucci  <[email protected]>
 
         Should avoid navigation for some data detector urls.

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (195769 => 195770)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2016-01-28 19:40:36 UTC (rev 195769)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2016-01-28 19:52:57 UTC (rev 195770)
@@ -1475,7 +1475,7 @@
     // If this is a reload the cache layer might have made the previous request conditional. DocumentLoader can't handle 304 responses itself.
     request.makeUnconditional();
 
-    static NeverDestroyed<ResourceLoaderOptions> mainResourceLoadOptions(SendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForAllCredentials, ClientRequestedCredentials, SkipSecurityCheck, UseDefaultOriginRestrictionsForType, IncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading);
+    static NeverDestroyed<ResourceLoaderOptions> mainResourceLoadOptions(SendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForAllCredentials, ClientRequestedCredentials, SkipSecurityCheck, UseDefaultOriginRestrictionsForType, IncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading, CachingPolicy::AllowCaching);
     CachedResourceRequest cachedResourceRequest(request, mainResourceLoadOptions);
     cachedResourceRequest.setInitiator(*this);
     m_mainResource = m_cachedResourceLoader->requestMainResource(cachedResourceRequest);

Modified: trunk/Source/WebCore/loader/MediaResourceLoader.cpp (195769 => 195770)


--- trunk/Source/WebCore/loader/MediaResourceLoader.cpp	2016-01-28 19:40:36 UTC (rev 195769)
+++ trunk/Source/WebCore/loader/MediaResourceLoader.cpp	2016-01-28 19:52:57 UTC (rev 195770)
@@ -61,7 +61,7 @@
     StoredCredentials allowCredentials = m_crossOriginMode.isNull() || equalLettersIgnoringASCIICase(m_crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials;
 
     // ContentSecurityPolicyImposition::DoPolicyCheck is a placeholder value. It does not affect the request since Content Security Policy does not apply to raw resources.
-    CachedResourceRequest cacheRequest(request, ResourceLoaderOptions(SendCallbacks, DoNotSniffContent, bufferingPolicy, allowCredentials, DoNotAskClientForCrossOriginCredentials, ClientDidNotRequestCredentials, DoSecurityCheck, corsPolicy, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading));
+    CachedResourceRequest cacheRequest(request, ResourceLoaderOptions(SendCallbacks, DoNotSniffContent, bufferingPolicy, allowCredentials, DoNotAskClientForCrossOriginCredentials, ClientDidNotRequestCredentials, DoSecurityCheck, corsPolicy, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading, CachingPolicy::AllowCaching));
 
     if (!m_crossOriginMode.isNull())
         updateRequestForAccessControl(cacheRequest.mutableResourceRequest(), m_document.securityOrigin(), allowCredentials);

Modified: trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp (195769 => 195770)


--- trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp	2016-01-28 19:40:36 UTC (rev 195769)
+++ trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp	2016-01-28 19:52:57 UTC (rev 195770)
@@ -43,7 +43,7 @@
 // FIXME: Skip Content Security Policy check when associated plugin element is in a user agent shadow tree.
 // See <https://bugs.webkit.org/show_bug.cgi?id=146663>.
 NetscapePlugInStreamLoader::NetscapePlugInStreamLoader(Frame* frame, NetscapePlugInStreamLoaderClient* client)
-    : ResourceLoader(frame, ResourceLoaderOptions(SendCallbacks, SniffContent, DoNotBufferData, AllowStoredCredentials, AskClientForAllCredentials, ClientRequestedCredentials, SkipSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading))
+    : ResourceLoader(frame, ResourceLoaderOptions(SendCallbacks, SniffContent, DoNotBufferData, AllowStoredCredentials, AskClientForAllCredentials, ClientRequestedCredentials, SkipSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading, CachingPolicy::AllowCaching))
     , m_client(client)
 {
 #if ENABLE(CONTENT_EXTENSIONS)

Modified: trunk/Source/WebCore/loader/ResourceLoaderOptions.h (195769 => 195770)


--- trunk/Source/WebCore/loader/ResourceLoaderOptions.h	2016-01-28 19:40:36 UTC (rev 195769)
+++ trunk/Source/WebCore/loader/ResourceLoaderOptions.h	2016-01-28 19:52:57 UTC (rev 195770)
@@ -76,6 +76,11 @@
     DisallowDefersLoading
 };
 
+enum class CachingPolicy : uint8_t {
+    AllowCaching,
+    DisallowCaching
+};
+
 struct ResourceLoaderOptions {
     ResourceLoaderOptions()
         : m_sendLoadCallbacks(DoNotSendCallbacks)
@@ -90,7 +95,7 @@
     {
     }
 
-    ResourceLoaderOptions(SendCallbackPolicy sendLoadCallbacks, ContentSniffingPolicy sniffContent, DataBufferingPolicy dataBufferingPolicy, StoredCredentials allowCredentials, ClientCredentialPolicy credentialPolicy, CredentialRequest credentialRequest, SecurityCheckPolicy securityCheck, RequestOriginPolicy requestOriginPolicy, CertificateInfoPolicy certificateInfoPolicy, ContentSecurityPolicyImposition contentSecurityPolicyImposition, DefersLoadingPolicy defersLoadingPolicy)
+    ResourceLoaderOptions(SendCallbackPolicy sendLoadCallbacks, ContentSniffingPolicy sniffContent, DataBufferingPolicy dataBufferingPolicy, StoredCredentials allowCredentials, ClientCredentialPolicy credentialPolicy, CredentialRequest credentialRequest, SecurityCheckPolicy securityCheck, RequestOriginPolicy requestOriginPolicy, CertificateInfoPolicy certificateInfoPolicy, ContentSecurityPolicyImposition contentSecurityPolicyImposition, DefersLoadingPolicy defersLoadingPolicy, CachingPolicy cachingPolicy)
         : m_sendLoadCallbacks(sendLoadCallbacks)
         , m_sniffContent(sniffContent)
         , m_dataBufferingPolicy(dataBufferingPolicy)
@@ -102,6 +107,7 @@
         , m_certificateInfoPolicy(certificateInfoPolicy)
         , m_contentSecurityPolicyImposition(contentSecurityPolicyImposition)
         , m_defersLoadingPolicy(defersLoadingPolicy)
+        , m_cachingPolicy(cachingPolicy)
     {
     }
 
@@ -127,6 +133,8 @@
     void setContentSecurityPolicyImposition(ContentSecurityPolicyImposition imposition) { m_contentSecurityPolicyImposition = imposition; }
     DefersLoadingPolicy defersLoadingPolicy() const { return m_defersLoadingPolicy; }
     void setDefersLoadingPolicy(DefersLoadingPolicy defersLoadingPolicy) { m_defersLoadingPolicy = defersLoadingPolicy; }
+    CachingPolicy cachingPolicy() const { return m_cachingPolicy; }
+    void setCachingPolicy(CachingPolicy cachingPolicy) { m_cachingPolicy = cachingPolicy; }
 
     unsigned m_sendLoadCallbacks : 1;
     unsigned m_sniffContent : 1;
@@ -139,6 +147,7 @@
     unsigned m_certificateInfoPolicy : 1; // Whether the response should include certificate info.
     ContentSecurityPolicyImposition m_contentSecurityPolicyImposition { ContentSecurityPolicyImposition::DoPolicyCheck };
     DefersLoadingPolicy m_defersLoadingPolicy { DefersLoadingPolicy::AllowDefersLoading };
+    CachingPolicy m_cachingPolicy { CachingPolicy::AllowCaching };
 };
 
 } // namespace WebCore    

Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (195769 => 195770)


--- trunk/Source/WebCore/loader/cache/CachedResource.cpp	2016-01-28 19:40:36 UTC (rev 195769)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp	2016-01-28 19:52:57 UTC (rev 195770)
@@ -159,7 +159,7 @@
     ASSERT(canDelete());
     ASSERT(!inCache());
     ASSERT(!m_deleted);
-    ASSERT(url().isNull() || MemoryCache::singleton().resourceForRequest(resourceRequest(), sessionID()) != this);
+    ASSERT(url().isNull() || !allowsCaching() || MemoryCache::singleton().resourceForRequest(resourceRequest(), sessionID()) != this);
 
 #ifndef NDEBUG
     m_deleted = true;
@@ -174,7 +174,7 @@
 {
     // FIXME: What if resources in other frames were waiting for this revalidation?
     LOG(ResourceLoading, "Cannot start loading '%s'", url().string().latin1().data());
-    if (m_resourceToRevalidate) 
+    if (allowsCaching() && m_resourceToRevalidate)
         MemoryCache::singleton().revalidationFailed(*this);
     error(CachedResource::LoadError);
 }
@@ -452,7 +452,7 @@
         else
             m_preloadResult = PreloadReferenced;
     }
-    if (!hasClients() && inCache())
+    if (allowsCaching() && !hasClients() && inCache())
         MemoryCache::singleton().addToLiveResourcesSize(*this);
 
     if ((m_type == RawResource || m_type == MainResource) && !m_response.isNull() && !m_proxyResource) {
@@ -483,7 +483,7 @@
     }
 
     bool deleted = deleteIfPossible();
-    if (!deleted && !hasClients()) {
+    if (allowsCaching() && !deleted && !hasClients()) {
         auto& memoryCache = MemoryCache::singleton();
         if (inCache()) {
             memoryCache.removeFromLiveResourcesSize(*this);
@@ -541,12 +541,12 @@
 
     // The object must be moved to a different queue, since its size has been changed.
     // Remove before updating m_decodedSize, so we find the resource in the correct LRU list.
-    if (inCache())
+    if (allowsCaching() && inCache())
         MemoryCache::singleton().removeFromLRUList(*this);
     
     m_decodedSize = size;
    
-    if (inCache()) {
+    if (allowsCaching() && inCache()) {
         auto& memoryCache = MemoryCache::singleton();
         // Now insert into the new LRU list.
         memoryCache.insertInLRUList(*this);
@@ -578,12 +578,12 @@
 
     // The object must be moved to a different queue, since its size has been changed.
     // Remove before updating m_encodedSize, so we find the resource in the correct LRU list.
-    if (inCache())
+    if (allowsCaching() && inCache())
         MemoryCache::singleton().removeFromLRUList(*this);
 
     m_encodedSize = size;
 
-    if (inCache()) {
+    if (allowsCaching() && inCache()) {
         auto& memoryCache = MemoryCache::singleton();
         memoryCache.insertInLRUList(*this);
         memoryCache.adjustSize(hasClients(), delta);
@@ -594,7 +594,7 @@
 {
     m_lastDecodedAccessTime = timeStamp;
     
-    if (inCache()) {
+    if (allowsCaching() && inCache()) {
         auto& memoryCache = MemoryCache::singleton();
         if (memoryCache.inLiveDecodedResourcesList(*this)) {
             memoryCache.removeFromLiveDecodedResourcesList(*this);

Modified: trunk/Source/WebCore/loader/cache/CachedResource.h (195769 => 195770)


--- trunk/Source/WebCore/loader/cache/CachedResource.h	2016-01-28 19:40:36 UTC (rev 195769)
+++ trunk/Source/WebCore/loader/cache/CachedResource.h	2016-01-28 19:52:57 UTC (rev 195770)
@@ -218,6 +218,8 @@
 
     bool shouldSendResourceLoadCallbacks() const { return m_options.sendLoadCallbacks() == SendCallbacks; }
     DataBufferingPolicy dataBufferingPolicy() const { return m_options.dataBufferingPolicy(); }
+
+    bool allowsCaching() const { return m_options.cachingPolicy() == CachingPolicy::AllowCaching; }
     
     virtual void destroyDecodedData() { }
 

Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (195769 => 195770)


--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2016-01-28 19:40:36 UTC (rev 195769)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2016-01-28 19:52:57 UTC (rev 195770)
@@ -221,20 +221,24 @@
 #endif
 
     auto& memoryCache = MemoryCache::singleton();
-    if (CachedResource* existing = memoryCache.resourceForRequest(request.resourceRequest(), sessionID())) {
-        if (is<CachedCSSStyleSheet>(*existing))
-            return downcast<CachedCSSStyleSheet>(existing);
-        memoryCache.remove(*existing);
+    if (request.allowsCaching()) {
+        if (CachedResource* existing = memoryCache.resourceForRequest(request.resourceRequest(), sessionID())) {
+            if (is<CachedCSSStyleSheet>(*existing))
+                return downcast<CachedCSSStyleSheet>(existing);
+            memoryCache.remove(*existing);
+        }
     }
+
     if (url.string() != request.resourceRequest().url())
         request.mutableResourceRequest().setURL(url);
 
     CachedResourceHandle<CachedCSSStyleSheet> userSheet = new CachedCSSStyleSheet(request.resourceRequest(), request.charset(), sessionID());
 
-    memoryCache.add(*userSheet);
+    if (request.allowsCaching())
+        memoryCache.add(*userSheet);
     // FIXME: loadResource calls setOwningCachedResourceLoader() if the resource couldn't be added to cache. Does this function need to call it, too?
 
-    userSheet->load(*this, ResourceLoaderOptions(DoNotSendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForAllCredentials, ClientRequestedCredentials, SkipSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::SkipPolicyCheck, DefersLoadingPolicy::AllowDefersLoading));
+    userSheet->load(*this, ResourceLoaderOptions(DoNotSendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForAllCredentials, ClientRequestedCredentials, SkipSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::SkipPolicyCheck, DefersLoadingPolicy::AllowDefersLoading, CachingPolicy::AllowCaching));
     
     return userSheet;
 }
@@ -555,7 +559,7 @@
 #endif
 
     auto& memoryCache = MemoryCache::singleton();
-    if (memoryCache.disabled()) {
+    if (request.allowsCaching() && memoryCache.disabled()) {
         DocumentResourceMap::iterator it = m_documentResources.find(url.string());
         if (it != m_documentResources.end()) {
             it->value->setOwningCachedResourceLoader(nullptr);
@@ -570,7 +574,8 @@
         request.mutableResourceRequest().setDomainForCachePartition(document()->topOrigin()->domainForCachePartition());
 #endif
 
-    resource = memoryCache.resourceForRequest(request.resourceRequest(), sessionID());
+    if (request.allowsCaching())
+        resource = memoryCache.resourceForRequest(request.resourceRequest(), sessionID());
 
     logMemoryCacheResourceRequest(frame(), resource ? DiagnosticLoggingKeys::inMemoryCacheKey() : DiagnosticLoggingKeys::notInMemoryCacheKey());
 
@@ -608,7 +613,7 @@
 
         // We don't support immediate loads, but we do support immediate failure.
         if (resource->errorOccurred()) {
-            if (resource->inCache())
+            if (resource->allowsCaching() && resource->inCache())
                 memoryCache.remove(*resource);
             return nullptr;
         }
@@ -636,6 +641,7 @@
     ASSERT(resource->canUseCacheValidator());
     ASSERT(!resource->resourceToRevalidate());
     ASSERT(resource->sessionID() == sessionID());
+    ASSERT(resource->allowsCaching());
 
     CachedResourceHandle<CachedResource> newResource = createResource(resource->type(), resource->resourceRequest(), resource->encoding(), resource->sessionID());
 
@@ -661,7 +667,7 @@
 
     CachedResourceHandle<CachedResource> resource = createResource(type, request.mutableResourceRequest(), request.charset(), sessionID());
 
-    if (!memoryCache.add(*resource))
+    if (request.allowsCaching() && !memoryCache.add(*resource))
         resource->setOwningCachedResourceLoader(this);
 #if ENABLE(RESOURCE_TIMING)
     storeResourceTimingInitiatorInformation(resource, request);
@@ -1151,7 +1157,7 @@
                 imageMisses++;
         }
         
-        if (resource->errorOccurred())
+        if (resource->errorOccurred() && resource->preloadResult() == CachedResource::PreloadNotReferenced)
             MemoryCache::singleton().remove(resource);
         
         resource->decreasePreloadCount();
@@ -1169,7 +1175,7 @@
 
 const ResourceLoaderOptions& CachedResourceLoader::defaultCachedResourceOptions()
 {
-    static ResourceLoaderOptions options(SendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForAllCredentials, ClientRequestedCredentials, DoSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading);
+    static ResourceLoaderOptions options(SendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForAllCredentials, ClientRequestedCredentials, DoSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading, CachingPolicy::AllowCaching);
     return options;
 }
 

Modified: trunk/Source/WebCore/loader/cache/CachedResourceRequest.h (195769 => 195770)


--- trunk/Source/WebCore/loader/cache/CachedResourceRequest.h	2016-01-28 19:40:36 UTC (rev 195769)
+++ trunk/Source/WebCore/loader/cache/CachedResourceRequest.h	2016-01-28 19:52:57 UTC (rev 195770)
@@ -60,6 +60,7 @@
     void setInitiator(PassRefPtr<Element>);
     void setInitiator(const AtomicString& name);
     const AtomicString& initiatorName() const;
+    bool allowsCaching() const { return m_options.cachingPolicy() == CachingPolicy::AllowCaching; }
 
     void setInitiator(DocumentLoader&);
     DocumentLoader* initiatingDocumentLoader() const { return m_initiatingDocumentLoader.get(); }

Modified: trunk/Source/WebCore/loader/icon/IconLoader.cpp (195769 => 195770)


--- trunk/Source/WebCore/loader/icon/IconLoader.cpp	2016-01-28 19:40:36 UTC (rev 195769)
+++ trunk/Source/WebCore/loader/icon/IconLoader.cpp	2016-01-28 19:52:57 UTC (rev 195770)
@@ -59,7 +59,7 @@
         return;
 
     // ContentSecurityPolicyImposition::DoPolicyCheck is a placeholder value. It does not affect the request since Content Security Policy does not apply to raw resources.
-    CachedResourceRequest request(ResourceRequest(m_frame.loader().icon().url()), ResourceLoaderOptions(SendCallbacks, SniffContent, BufferData, DoNotAllowStoredCredentials, DoNotAskClientForAnyCredentials, ClientDidNotRequestCredentials, DoSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading));
+    CachedResourceRequest request(ResourceRequest(m_frame.loader().icon().url()), ResourceLoaderOptions(SendCallbacks, SniffContent, BufferData, DoNotAllowStoredCredentials, DoNotAskClientForAnyCredentials, ClientDidNotRequestCredentials, DoSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading, CachingPolicy::AllowCaching));
 
     request.mutableResourceRequest().setPriority(ResourceLoadPriority::Low);
     request.setInitiator(cachedResourceRequestInitiators().icon);

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm (195769 => 195770)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm	2016-01-28 19:40:36 UTC (rev 195769)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm	2016-01-28 19:52:57 UTC (rev 195770)
@@ -68,7 +68,7 @@
     NSURLRequest *nsRequest = [m_avRequest.get() request];
 
     // ContentSecurityPolicyImposition::DoPolicyCheck is a placeholder value. It does not affect the request since Content Security Policy does not apply to raw resources.
-    CachedResourceRequest request(nsRequest, ResourceLoaderOptions(SendCallbacks, DoNotSniffContent, BufferData, DoNotAllowStoredCredentials, DoNotAskClientForCrossOriginCredentials, ClientDidNotRequestCredentials, DoSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading));
+    CachedResourceRequest request(nsRequest, ResourceLoaderOptions(SendCallbacks, DoNotSniffContent, BufferData, DoNotAllowStoredCredentials, DoNotAskClientForCrossOriginCredentials, ClientDidNotRequestCredentials, DoSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading, CachingPolicy::DisallowCaching));
 
     request.mutableResourceRequest().setPriority(ResourceLoadPriority::Low);
     CachedResourceLoader* loader = m_parent->player()->cachedResourceLoader();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to