Resources from non-HTTP schemes should not be cached indefinitely
https://bugs.webkit.org/show_bug.cgi?id=113626

Reviewed by Ryosuke Niwa.

Source/WebCore:

With the exception of schemes that we know will always return the same
result for a given URL, we should not indefinitely cache non-HTTP
resources when their freshness cannot be verified.

Writing a test for this is blocked on https://webkit.org/b/116199.

The following two existing tests of memory cache behavior were
converted to HTTP tests so that they continue to function as expected:

Tests: http/tests/cache/display-image-unset-allows-cached-image-load.html
       http/tests/cache/willsendrequest-returns-null-for-memory-cache-load.html

* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::freshnessLifetime): Returned a freshness
lifetime of 0 for non-HTTP schemes that can't be indefinitely cached.
* platform/SchemeRegistry.cpp:
(WebCore::SchemeRegistry::shouldCacheResponsesFromURLSchemeIndefinitely):
Checked whether the scheme is blob:, data:, or applewebdata:.
* platform/SchemeRegistry.h:

LayoutTests:

Convert existing memory cache tests to HTTP tests.

* fast/loader/resources/compass.jpg: Removed.
* fast/loader/resources/image1.html: Removed.
* fast/loader/resources/image2.html: Removed.
* fast/loader/willsendrequest-returns-null-for-memory-cache-load-expected.txt: Removed.
* 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.
* http/tests/cache/display-image-unset-allows-cached-image-load.html: Renamed from LayoutTests/fast/loader/display-image-unset-allows-cached-image-load.html.
* http/tests/cache/resources/cached-image.html: Renamed from LayoutTests/fast/loader/resources/cached-image.html.
* http/tests/cache/resources/image1.html: Added.
* http/tests/cache/resources/image2.html: Added.
* http/tests/cache/willsendrequest-returns-null-for-memory-cache-load-expected.txt: Added.
* http/tests/cache/willsendrequest-returns-null-for-memory-cache-load.html: Renamed from LayoutTests/fast/loader/willsendrequest-returns-null-for-memory-cache-load.html.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150169 268f45cc-cd09-0410-ab3c-d52691b4dbfc