Changeset 247276 in webkit


Ignore:
Timestamp:
Jul 9, 2019 1:44:07 PM (5 years ago)
Author:
youenn@apple.com
Message:

XHR CORS requests logged twice in the server
https://bugs.webkit.org/show_bug.cgi?id=199492
<rdar://problem/52757558>

Reviewed by Chris Dumez.

Source/WebKit:

Disable speculative loading for XHR and fetch.
These speculative requests might have specific headers that are no longer relevant
when reloading the page. This might then confuse servers.

  • NetworkProcess/cache/NetworkCache.cpp:

(WebKit::NetworkCache::makeStoreDecision):
(WebKit::NetworkCache::canRequestUseSpeculativeRevalidation):
(WebKit::NetworkCache::Cache::retrieve):

LayoutTests:

  • http/wpt/fetch/disable-speculative-load-for-xhr-and-fetch-loads-expected.txt: Added.
  • http/wpt/fetch/disable-speculative-load-for-xhr-and-fetch-loads.html: Added.
  • http/wpt/fetch/resources/fetch-xhr-load.py: Added.

(main):

  • http/wpt/fetch/resources/xhr-and-fetch.html: Added.
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r247271 r247276  
     12019-07-09  Youenn Fablet  <youenn@apple.com>
     2
     3        XHR CORS requests logged twice in the server
     4        https://bugs.webkit.org/show_bug.cgi?id=199492
     5        <rdar://problem/52757558>
     6
     7        Reviewed by Chris Dumez.
     8
     9        * http/wpt/fetch/disable-speculative-load-for-xhr-and-fetch-loads-expected.txt: Added.
     10        * http/wpt/fetch/disable-speculative-load-for-xhr-and-fetch-loads.html: Added.
     11        * http/wpt/fetch/resources/fetch-xhr-load.py: Added.
     12        (main):
     13        * http/wpt/fetch/resources/xhr-and-fetch.html: Added.
     14
    1152019-07-09  Rob Buis  <rbuis@igalia.com>
    216
  • trunk/Source/WebKit/ChangeLog

    r247274 r247276  
     12019-07-09  Youenn Fablet  <youenn@apple.com>
     2
     3        XHR CORS requests logged twice in the server
     4        https://bugs.webkit.org/show_bug.cgi?id=199492
     5        <rdar://problem/52757558>
     6
     7        Reviewed by Chris Dumez.
     8
     9        Disable speculative loading for XHR and fetch.
     10        These speculative requests might have specific headers that are no longer relevant
     11        when reloading the page. This might then confuse servers.
     12
     13        * NetworkProcess/cache/NetworkCache.cpp:
     14        (WebKit::NetworkCache::makeStoreDecision):
     15        (WebKit::NetworkCache::canRequestUseSpeculativeRevalidation):
     16        (WebKit::NetworkCache::Cache::retrieve):
     17
    1182019-07-09  Chris Dumez  <cdumez@apple.com>
    219
  • trunk/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp

    r246490 r247276  
    270270}
    271271
     272#if ENABLE(NETWORK_CACHE_SPECULATIVE_REVALIDATION)
     273static bool inline canRequestUseSpeculativeRevalidation(const ResourceRequest& request)
     274{
     275    if (request.isConditional())
     276        return false;
     277
     278    if (cachePolicyAllowsExpired(request.cachePolicy()))
     279        return false;
     280
     281    return request.requester() != ResourceRequest::Requester::XHR && request.requester() != ResourceRequest::Requester::Fetch;
     282}
     283#endif
     284
    272285void Cache::retrieve(const WebCore::ResourceRequest& request, const GlobalFrameID& frameID, RetrieveCompletionHandler&& completionHandler)
    273286{
     
    284297
    285298#if ENABLE(NETWORK_CACHE_SPECULATIVE_REVALIDATION)
    286     bool canUseSpeculativeRevalidation = m_speculativeLoadManager && !request.isConditional() && !cachePolicyAllowsExpired(request.cachePolicy());
     299    bool canUseSpeculativeRevalidation = m_speculativeLoadManager && canRequestUseSpeculativeRevalidation(request);
    287300    if (canUseSpeculativeRevalidation)
    288301        m_speculativeLoadManager->registerLoad(frameID, request, storageKey);
Note: See TracChangeset for help on using the changeset viewer.