Title: [207753] trunk/Source/WebCore
Revision
207753
Author
commit-qu...@webkit.org
Date
2016-10-24 00:52:09 -0700 (Mon, 24 Oct 2016)

Log Message

Remove CachedResource::passesSameOriginPolicyCheck
https://bugs.webkit.org/show_bug.cgi?id=163593

Patch by Youenn Fablet <you...@apple.com> on 2016-10-24
Reviewed by Andreas Kling.

No change of behavior.

Removing no-longer used code.

* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::redirectReceived):
(WebCore::CachedResource::passesAccessControlCheck): Deleted.
(WebCore::CachedResource::passesSameOriginPolicyCheck): Deleted.
(WebCore::CachedResource::responseForSameOriginPolicyChecks): Deleted.
* loader/cache/CachedResource.h:
(WebCore::CachedResource::response):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (207752 => 207753)


--- trunk/Source/WebCore/ChangeLog	2016-10-24 07:49:14 UTC (rev 207752)
+++ trunk/Source/WebCore/ChangeLog	2016-10-24 07:52:09 UTC (rev 207753)
@@ -1,5 +1,24 @@
 2016-10-24  Youenn Fablet  <you...@apple.com>
 
+        Remove CachedResource::passesSameOriginPolicyCheck
+        https://bugs.webkit.org/show_bug.cgi?id=163593
+
+        Reviewed by Andreas Kling.
+
+        No change of behavior.
+
+        Removing no-longer used code.
+
+        * loader/cache/CachedResource.cpp:
+        (WebCore::CachedResource::redirectReceived):
+        (WebCore::CachedResource::passesAccessControlCheck): Deleted.
+        (WebCore::CachedResource::passesSameOriginPolicyCheck): Deleted.
+        (WebCore::CachedResource::responseForSameOriginPolicyChecks): Deleted.
+        * loader/cache/CachedResource.h:
+        (WebCore::CachedResource::response):
+
+2016-10-24  Youenn Fablet  <you...@apple.com>
+
         Redirections should be upgraded if CSP policy says so
         https://bugs.webkit.org/show_bug.cgi?id=163544
 

Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (207752 => 207753)


--- trunk/Source/WebCore/loader/cache/CachedResource.cpp	2016-10-24 07:49:14 UTC (rev 207752)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp	2016-10-24 07:52:09 UTC (rev 207753)
@@ -410,19 +410,6 @@
         m_status = Cached;
 }
 
-bool CachedResource::passesAccessControlCheck(SecurityOrigin& securityOrigin)
-{
-    String errorDescription;
-    return WebCore::passesAccessControlCheck(response(), resourceRequest().allowCookies() ? AllowStoredCredentials : DoNotAllowStoredCredentials, securityOrigin, errorDescription);
-}
-
-bool CachedResource::passesSameOriginPolicyCheck(SecurityOrigin& securityOrigin)
-{
-    if (securityOrigin.canRequest(responseForSameOriginPolicyChecks().url()))
-        return true;
-    return passesAccessControlCheck(securityOrigin);
-}
-
 void CachedResource::setCrossOrigin()
 {
     ASSERT(m_options.mode != FetchOptions::Mode::SameOrigin);
@@ -484,24 +471,15 @@
     return computeFreshnessLifetimeForHTTPFamily(response, m_responseTimestamp);
 }
 
-void CachedResource::redirectReceived(ResourceRequest& request, const ResourceResponse& response)
+void CachedResource::redirectReceived(ResourceRequest&, const ResourceResponse& response)
 {
     m_requestedFromNetworkingLayer = true;
     if (response.isNull())
         return;
 
-    // Redirect to data: URL uses the last HTTP response for SOP.
-    if (response.isHTTP() && request.url().protocolIsData())
-        m_redirectResponseForSameOriginPolicyChecks = response;
-
     updateRedirectChainStatus(m_redirectChainCacheStatus, response);
 }
 
-const ResourceResponse& CachedResource::responseForSameOriginPolicyChecks() const
-{
-    return m_redirectResponseForSameOriginPolicyChecks.isNull() ? m_response : m_redirectResponseForSameOriginPolicyChecks;
-}
-
 void CachedResource::setResponse(const ResourceResponse& response)
 {
     ASSERT(m_response.type() == ResourceResponse::Type::Default);

Modified: trunk/Source/WebCore/loader/cache/CachedResource.h (207752 => 207753)


--- trunk/Source/WebCore/loader/cache/CachedResource.h	2016-10-24 07:49:14 UTC (rev 207752)
+++ trunk/Source/WebCore/loader/cache/CachedResource.h	2016-10-24 07:52:09 UTC (rev 207753)
@@ -20,8 +20,7 @@
     Boston, MA 02110-1301, USA.
 */
 
-#ifndef CachedResource_h
-#define CachedResource_h
+#pragma once
 
 #include "CachePolicy.h"
 #include "CacheValidation.h"
@@ -42,12 +41,12 @@
 
 namespace WebCore {
 
-class MemoryCache;
 class CachedResourceClient;
 class CachedResourceHandleBase;
 class CachedResourceLoader;
 class CachedResourceRequest;
 class InspectorResource;
+class MemoryCache;
 class SecurityOrigin;
 class SharedBuffer;
 class SubresourceLoader;
@@ -60,7 +59,7 @@
     WTF_MAKE_NONCOPYABLE(CachedResource); WTF_MAKE_FAST_ALLOCATED;
     friend class MemoryCache;
     friend class InspectorResource;
-    
+
 public:
     enum Type {
         MainResource,
@@ -152,7 +151,7 @@
     unsigned encodedSize() const { return m_encodedSize; }
     unsigned decodedSize() const { return m_decodedSize; }
     unsigned overheadSize() const;
-    
+
     bool isLoaded() const { return !m_loading; } // FIXME. Method name is inaccurate. Loading might not have started yet.
 
     bool isLoading() const { return m_loading; }
@@ -180,13 +179,10 @@
     unsigned accessCount() const { return m_accessCount; }
     void increaseAccessCount() { m_accessCount++; }
 
-    // Computes the status of an object after loading.  
+    // Computes the status of an object after loading.
     // Updates the expire date on the cache entry file
     void finish();
 
-    bool passesAccessControlCheck(SecurityOrigin&);
-    bool passesSameOriginPolicyCheck(SecurityOrigin&);
-
     // Called by the cache if the object has been removed from the cache
     // while still being referenced. This means the object should delete itself
     // if the number of clients observing it ever drops to 0.
@@ -193,7 +189,7 @@
     // The resource can be brought back to cache after successful revalidation.
     void setInCache(bool inCache) { m_inCache = inCache; }
     bool inCache() const { return m_inCache; }
-    
+
     void clearLoader();
 
     SharedBuffer* resourceBuffer() const { return m_data.get(); }
@@ -203,8 +199,6 @@
     virtual bool shouldCacheResponse(const ResourceResponse&) { return true; }
     void setResponse(const ResourceResponse&);
     const ResourceResponse& response() const { return m_response; }
-    // This is the same as response() except after HTTP redirect to data: URL.
-    const ResourceResponse& responseForSameOriginPolicyChecks() const;
 
     void setCrossOrigin();
     bool isCrossOrigin() const;
@@ -295,7 +289,6 @@
     ResourceLoaderOptions m_options;
     ResourceResponse m_response;
     ResourceResponse::Tainting m_responseTainting { ResourceResponse::Tainting::Basic };
-    ResourceResponse m_redirectResponseForSameOriginPolicyChecks;
     RefPtr<SharedBuffer> m_data;
     DeferrableOneShotTimer m_decodedDataDeletionTimer;
 
@@ -352,7 +345,7 @@
 #endif
 
     CachedResourceLoader* m_owningCachedResourceLoader { nullptr }; // only non-null for resources that are not in the cache
-    
+
     // If this field is non-null we are using the resource as a proxy for checking whether an existing resource is still up to date
     // using HTTP If-Modified-Since/If-None-Match headers. If the response is 304 all clients of this resource are moved
     // to to be clients of m_resourceToRevalidate and the resource is deleted. If not, the field is zeroed and this
@@ -395,5 +388,3 @@
 SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ToClassName) \
     static bool isType(const WebCore::CachedResource& resource) { return resource.type() == WebCore::CachedResourceType; } \
 SPECIALIZE_TYPE_TRAITS_END()
-
-#endif // CachedResource_h
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to