Changeset 247314 in webkit


Ignore:
Timestamp:
Jul 10, 2019 11:17:59 AM (5 years ago)
Author:
youenn@apple.com
Message:

Disable speculative loading if cache is not to be used for the load
https://bugs.webkit.org/show_bug.cgi?id=199644

Reviewed by Chris Dumez.

Source/WebKit:

When the page is reloaded, loads are instructed to not use the cache.
It is therefore unneeded to do speculative revalidation.
Allow speculative revalidation if the cache policy is either the default HTTP policy or
if policy is to refresh all cache data.
Covered by added test.

  • NetworkProcess/cache/NetworkCache.cpp:

(WebKit::NetworkCache::cachePolicyValidForSpeculativeRevalidation):
(WebKit::NetworkCache::canRequestUseSpeculativeRevalidation):

LayoutTests:

  • http/wpt/fetch/disable-speculative-for-reload-expected.txt: Added.
  • http/wpt/fetch/disable-speculative-for-reload.html: Added.
  • http/wpt/fetch/resources/iframe-with-image.py: Added.

(main):

  • http/wpt/fetch/resources/image-load-count.py: Added.

(main):

  • http/wpt/fetch/resources/image-load.py: Added.

(main):

Location:
trunk
Files:
5 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r247313 r247314  
     12019-07-10  Youenn Fablet  <youenn@apple.com>
     2
     3        Disable speculative loading if cache is not to be used for the load
     4        https://bugs.webkit.org/show_bug.cgi?id=199644
     5
     6        Reviewed by Chris Dumez.
     7
     8        * http/wpt/fetch/disable-speculative-for-reload-expected.txt: Added.
     9        * http/wpt/fetch/disable-speculative-for-reload.html: Added.
     10        * http/wpt/fetch/resources/iframe-with-image.py: Added.
     11        (main):
     12        * http/wpt/fetch/resources/image-load-count.py: Added.
     13        (main):
     14        * http/wpt/fetch/resources/image-load.py: Added.
     15        (main):
     16
    1172019-07-10  Youenn Fablet  <youenn@apple.com>
    218
  • trunk/Source/WebKit/ChangeLog

    r247308 r247314  
     12019-07-10  Youenn Fablet  <youenn@apple.com>
     2
     3        Disable speculative loading if cache is not to be used for the load
     4        https://bugs.webkit.org/show_bug.cgi?id=199644
     5
     6        Reviewed by Chris Dumez.
     7
     8        When the page is reloaded, loads are instructed to not use the cache.
     9        It is therefore unneeded to do speculative revalidation.
     10        Allow speculative revalidation if the cache policy is either the default HTTP policy or
     11        if policy is to refresh all cache data.
     12        Covered by added test.
     13
     14        * NetworkProcess/cache/NetworkCache.cpp:
     15        (WebKit::NetworkCache::cachePolicyValidForSpeculativeRevalidation):
     16        (WebKit::NetworkCache::canRequestUseSpeculativeRevalidation):
     17
    1182019-07-10  Alex Christensen  <achristensen@webkit.org>
    219
  • trunk/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp

    r247276 r247314  
    271271
    272272#if ENABLE(NETWORK_CACHE_SPECULATIVE_REVALIDATION)
     273static bool cachePolicyValidForSpeculativeRevalidation(WebCore::ResourceRequestCachePolicy policy)
     274{
     275    switch (policy) {
     276    case WebCore::ResourceRequestCachePolicy::ReturnCacheDataElseLoad:
     277    case WebCore::ResourceRequestCachePolicy::ReturnCacheDataDontLoad:
     278    case WebCore::ResourceRequestCachePolicy::ReloadIgnoringCacheData:
     279        return false;
     280    case WebCore::ResourceRequestCachePolicy::UseProtocolCachePolicy:
     281    case WebCore::ResourceRequestCachePolicy::RefreshAnyCacheData:
     282        return true;
     283    case WebCore::ResourceRequestCachePolicy::DoNotUseAnyCache:
     284        ASSERT_NOT_REACHED();
     285        return false;
     286    }
     287    return false;
     288}
     289
    273290static bool inline canRequestUseSpeculativeRevalidation(const ResourceRequest& request)
    274291{
     
    276293        return false;
    277294
    278     if (cachePolicyAllowsExpired(request.cachePolicy()))
     295    if (cachePolicyValidForSpeculativeRevalidation(request.cachePolicy()))
    279296        return false;
    280297
Note: See TracChangeset for help on using the changeset viewer.