Changeset 248269 in webkit


Ignore:
Timestamp:
Aug 5, 2019 9:26:00 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 Alex Christensen.

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

    r248268 r248269  
     12019-08-05  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 Alex Christensen.
     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-08-05  Takashi Komori  <Takashi.Komori@sony.com>
    218
  • trunk/Source/WebKit/ChangeLog

    r248264 r248269  
     12019-08-05  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 Alex Christensen.
     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-08-04  Konstantin Tokarev  <annulen@yandex.ru>
    219
  • trunk/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp

    r247861 r248269  
    276276        return false;
    277277
    278     if (cachePolicyAllowsExpired(request.cachePolicy()))
     278    if (request.requester() == ResourceRequest::Requester::XHR || request.requester() == ResourceRequest::Requester::Fetch)
    279279        return false;
    280280
    281     return request.requester() != ResourceRequest::Requester::XHR && request.requester() != ResourceRequest::Requester::Fetch;
     281    switch (request.cachePolicy()) {
     282    case WebCore::ResourceRequestCachePolicy::ReturnCacheDataElseLoad:
     283    case WebCore::ResourceRequestCachePolicy::ReturnCacheDataDontLoad:
     284    case WebCore::ResourceRequestCachePolicy::ReloadIgnoringCacheData:
     285        return false;
     286    case WebCore::ResourceRequestCachePolicy::UseProtocolCachePolicy:
     287    case WebCore::ResourceRequestCachePolicy::RefreshAnyCacheData:
     288        return true;
     289    case WebCore::ResourceRequestCachePolicy::DoNotUseAnyCache:
     290        ASSERT_NOT_REACHED();
     291        return false;
     292    }
     293    return false;
    282294}
    283295#endif
Note: See TracChangeset for help on using the changeset viewer.