Changeset 150169 in webkit
- Timestamp:
- May 15, 2013 7:54:06 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 4 deleted
- 5 edited
- 4 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r150155 r150169 1 2013-05-15 Andy Estes <aestes@apple.com> 2 3 Resources from non-HTTP schemes should not be cached indefinitely 4 https://bugs.webkit.org/show_bug.cgi?id=113626 5 6 Reviewed by Ryosuke Niwa. 7 8 Convert existing memory cache tests to HTTP tests. 9 10 * fast/loader/resources/compass.jpg: Removed. 11 * fast/loader/resources/image1.html: Removed. 12 * fast/loader/resources/image2.html: Removed. 13 * fast/loader/willsendrequest-returns-null-for-memory-cache-load-expected.txt: Removed. 14 * http/tests/cache/display-image-unset-allows-cached-image-load-expected.txt: Renamed from LayoutTests/fast/loader/display-image-unset-allows-cached-image-load-expected.txt. 15 * http/tests/cache/display-image-unset-allows-cached-image-load.html: Renamed from LayoutTests/fast/loader/display-image-unset-allows-cached-image-load.html. 16 * http/tests/cache/resources/cached-image.html: Renamed from LayoutTests/fast/loader/resources/cached-image.html. 17 * http/tests/cache/resources/image1.html: Added. 18 * http/tests/cache/resources/image2.html: Added. 19 * http/tests/cache/willsendrequest-returns-null-for-memory-cache-load-expected.txt: Added. 20 * http/tests/cache/willsendrequest-returns-null-for-memory-cache-load.html: Renamed from LayoutTests/fast/loader/willsendrequest-returns-null-for-memory-cache-load.html. 21 1 22 2013-05-15 Igor Oliveira <igor.o@sisa.samsung.com> 2 23 -
trunk/LayoutTests/http/tests/cache/resources/cached-image.html
r150168 r150169 3 3 testRunner.setWillSendRequestReturnsNull(true); 4 4 </script> 5 <img src=" compass.jpg" onload="console.log('FAIL: image was incorrectly loaded')">5 <img src="/misc/resources/compass.jpg" onload="console.log('FAIL: image was incorrectly loaded')"> -
trunk/LayoutTests/http/tests/cache/willsendrequest-returns-null-for-memory-cache-load.html
r150168 r150169 22 22 </head> 23 23 <body> 24 <img src=" resources/compass.jpg" onload="loadCachedImageInIFrame()">24 <img src="/misc/resources/compass.jpg" onload="loadCachedImageInIFrame()"> 25 25 </body> 26 26 </html> -
trunk/Source/WebCore/ChangeLog
r150167 r150169 1 2013-05-15 Andy Estes <aestes@apple.com> 2 3 Resources from non-HTTP schemes should not be cached indefinitely 4 https://bugs.webkit.org/show_bug.cgi?id=113626 5 6 Reviewed by Ryosuke Niwa. 7 8 With the exception of schemes that we know will always return the same 9 result for a given URL, we should not indefinitely cache non-HTTP 10 resources when their freshness cannot be verified. 11 12 Writing a test for this is blocked on https://webkit.org/b/116199. 13 14 The following two existing tests of memory cache behavior were 15 converted to HTTP tests so that they continue to function as expected: 16 17 Tests: http/tests/cache/display-image-unset-allows-cached-image-load.html 18 http/tests/cache/willsendrequest-returns-null-for-memory-cache-load.html 19 20 * loader/cache/CachedResource.cpp: 21 (WebCore::CachedResource::freshnessLifetime): Returned a freshness 22 lifetime of 0 for non-HTTP schemes that can't be indefinitely cached. 23 * platform/SchemeRegistry.cpp: 24 (WebCore::SchemeRegistry::shouldCacheResponsesFromURLSchemeIndefinitely): 25 Checked whether the scheme is blob:, data:, or applewebdata:. 26 * platform/SchemeRegistry.h: 27 1 28 2013-05-15 Tim Horton <timothy_horton@apple.com> 2 29 -
trunk/Source/WebCore/loader/cache/CachedResource.cpp
r150104 r150169 25 25 #include "CachedResource.h" 26 26 27 #include "MemoryCache.h"28 27 #include "CachedResourceClient.h" 29 28 #include "CachedResourceClientWalker.h" … … 39 38 #include "LoaderStrategy.h" 40 39 #include "Logging.h" 40 #include "MemoryCache.h" 41 41 #include "PlatformStrategies.h" 42 42 #include "PurgeableBuffer.h" … … 44 44 #include "ResourceHandle.h" 45 45 #include "ResourceLoadScheduler.h" 46 #include "SchemeRegistry.h" 46 47 #include "SecurityOrigin.h" 47 48 #include "SecurityPolicy.h" … … 400 401 return currentAge() > freshnessLifetime(); 401 402 } 402 403 403 404 double CachedResource::currentAge() const 404 405 { … … 412 413 return correctedReceivedAge + residentTime; 413 414 } 414 415 415 416 double CachedResource::freshnessLifetime() const 416 417 { 417 // Cache non-http resources liberally 418 if (SchemeRegistry::shouldCacheResponsesFromURLSchemeIndefinitely(m_response.url().protocol())) 419 return std::numeric_limits<double>::max(); 420 421 // Don't cache other non-HTTP resources since we can't check for freshness. 418 422 if (!m_response.url().protocolIsInHTTPFamily()) 419 return std::numeric_limits<double>::max();423 return 0; 420 424 421 425 // RFC2616 13.2.4 -
trunk/Source/WebCore/platform/SchemeRegistry.cpp
r120684 r150169 321 321 } 322 322 323 bool SchemeRegistry::shouldCacheResponsesFromURLSchemeIndefinitely(const String& scheme) 324 { 325 #if PLATFORM(MAC) 326 if (equalIgnoringCase(scheme, "applewebdata")) 327 return true; 328 #endif 329 return equalIgnoringCase(scheme, "blob") || equalIgnoringCase(scheme, "data"); 330 } 331 323 332 } // namespace WebCore -
trunk/Source/WebCore/platform/SchemeRegistry.h
r127757 r150169 89 89 static void removeURLSchemeRegisteredAsBypassingContentSecurityPolicy(const String& scheme); 90 90 static bool schemeShouldBypassContentSecurityPolicy(const String& scheme); 91 92 // Schemes whose responses can be cached indefinitely. 93 static bool shouldCacheResponsesFromURLSchemeIndefinitely(const String& scheme); 91 94 }; 92 95
Note: See TracChangeset
for help on using the changeset viewer.