Changeset 150863 in webkit


Ignore:
Timestamp:
May 28, 2013 9:56:08 PM (11 years ago)
Author:
aestes@apple.com
Message:

REGRESSION (r150169): Images from file: URLs display after a delay even though they were preloaded by JavaScript
https://bugs.webkit.org/show_bug.cgi?id=116906
<rdar://problem/13991927>

Reviewed by Andreas Kling.

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

Some WebKit clients use JavaScript to preload images from disk so that
subsequent loads will display immediately from the memory cache. By not
caching non-HTTP sub-resources in memory, we break this common pattern.
This change restricts r150169 to only apply to cached main resources.
Sub-resources will again be cached indefinitely as they were prior to
r150169.

  • loader/cache/CachedResource.cpp:

(WebCore::CachedResource::freshnessLifetime): If this is a non-HTTP
main resource from a scheme that should not be cached indefinitely,
return 0 for the freshness lifetime. For other non-HTTP cached
resources, return an indefinite freshness lifetime.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r150862 r150863  
     12013-05-28  Andy Estes  <aestes@apple.com>
     2
     3        REGRESSION (r150169): Images from file: URLs display after a delay even though they were preloaded by JavaScript
     4        https://bugs.webkit.org/show_bug.cgi?id=116906
     5        <rdar://problem/13991927>
     6
     7        Reviewed by Andreas Kling.
     8
     9        Writing a test for this is blocked on https://webkit.org/b/116199.
     10
     11        Some WebKit clients use JavaScript to preload images from disk so that
     12        subsequent loads will display immediately from the memory cache. By not
     13        caching non-HTTP sub-resources in memory, we break this common pattern.
     14        This change restricts r150169 to only apply to cached main resources.
     15        Sub-resources will again be cached indefinitely as they were prior to
     16        r150169.
     17
     18        * loader/cache/CachedResource.cpp:
     19        (WebCore::CachedResource::freshnessLifetime): If this is a non-HTTP
     20        main resource from a scheme that should not be cached indefinitely,
     21        return 0 for the freshness lifetime. For other non-HTTP cached
     22        resources, return an indefinite freshness lifetime.
     23
    1242013-05-28  Dean Jackson  <dino@apple.com>
    225
  • trunk/Source/WebCore/loader/cache/CachedResource.cpp

    r150169 r150863  
    416416double CachedResource::freshnessLifetime() const
    417417{
    418     if (SchemeRegistry::shouldCacheResponsesFromURLSchemeIndefinitely(m_response.url().protocol()))
     418    if (!m_response.url().protocolIsInHTTPFamily()) {
     419        // Don't cache non-HTTP main resources since we can't check for freshness.
     420        // FIXME: We should not cache subresources either, but when we tried this
     421        // it caused performance and flakiness issues in our test infrastructure.
     422        if (m_type == MainResource && !SchemeRegistry::shouldCacheResponsesFromURLSchemeIndefinitely(m_response.url().protocol()))
     423            return 0;
     424
    419425        return std::numeric_limits<double>::max();
    420 
    421     // Don't cache other non-HTTP resources since we can't check for freshness.
    422     if (!m_response.url().protocolIsInHTTPFamily())
    423         return 0;
     426    }
    424427
    425428    // RFC2616 13.2.4
Note: See TracChangeset for help on using the changeset viewer.