Changeset 220442 in webkit


Ignore:
Timestamp:
Aug 8, 2017 10:15:47 PM (7 years ago)
Author:
Chris Dumez
Message:

[Beacon] Add support for CORS-preflighting for WK2 / NETWORK_SESSION
https://bugs.webkit.org/show_bug.cgi?id=175264
<rdar://problem/33547793>

Reviewed by Youenn Fablet.

Source/WebCore:

Pass additional information when creating a PingHandle so that the PingLoad
can deal with CORS-preflighting on Network process side.

Tests: http/wpt/beacon/cors/cors-preflight-arraybufferview-failure.html

http/wpt/beacon/cors/cors-preflight-arraybufferview-success.html
http/wpt/beacon/cors/cors-preflight-blob-failure.html
http/wpt/beacon/cors/cors-preflight-blob-success.html
http/wpt/beacon/cors/cors-preflight-cookie.html

  • WebCore.xcodeproj/project.pbxproj:
  • loader/CrossOriginAccessControl.cpp:

(WebCore::validatePreflightResponse):

  • loader/CrossOriginAccessControl.h:
  • loader/CrossOriginPreflightChecker.cpp:

(WebCore::CrossOriginPreflightChecker::validatePreflightResponse):

  • loader/CrossOriginPreflightResultCache.h:
  • loader/LoaderStrategy.h:
  • loader/PingLoader.cpp:

(WebCore::PingLoader::loadImage):
(WebCore::PingLoader::sendPing):
(WebCore::PingLoader::sendViolationReport):
(WebCore::PingLoader::startPingLoad):

  • loader/PingLoader.h:
  • loader/cache/CachedResource.cpp:

(WebCore::CachedResource::load):

  • page/SecurityOrigin.h:

Source/WebKit:

Implement CORS-preflighting for beacons with a payload that has a non
safelisted MIME type, as per:

CORS-preflighting is completely handled on Network Process side because
a beacon request can outlive its page and therefore its WebContent
process. This requires us to pass a little more information to the
Network process, in particular the source origin and the corsMode.

The current implementation does not currently deal with CORS preflights
needed upon a redirect. This will be added in a follow-up.

  • CMakeLists.txt:
  • NetworkProcess/NetworkCORSPreflightChecker.cpp: Added.

(WebKit::NetworkCORSPreflightChecker::NetworkCORSPreflightChecker):
(WebKit::NetworkCORSPreflightChecker::~NetworkCORSPreflightChecker):
(WebKit::NetworkCORSPreflightChecker::startPreflight):
(WebKit::NetworkCORSPreflightChecker::willPerformHTTPRedirection):
(WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
(WebKit::NetworkCORSPreflightChecker::didReceiveResponseNetworkSession):
(WebKit::NetworkCORSPreflightChecker::didReceiveData):
(WebKit::NetworkCORSPreflightChecker::didCompleteWithError):
(WebKit::NetworkCORSPreflightChecker::didSendData):
(WebKit::NetworkCORSPreflightChecker::wasBlocked):
(WebKit::NetworkCORSPreflightChecker::cannotShowURL):

  • NetworkProcess/NetworkCORSPreflightChecker.h: Added.
  • NetworkProcess/NetworkConnectionToWebProcess.cpp:

(WebKit::NetworkConnectionToWebProcess::loadPing):

  • NetworkProcess/NetworkConnectionToWebProcess.h:
  • NetworkProcess/NetworkResourceLoadParameters.cpp:

(WebKit::NetworkResourceLoadParameters::encode const):
(WebKit::NetworkResourceLoadParameters::decode):

  • NetworkProcess/NetworkResourceLoadParameters.h:
  • NetworkProcess/PingLoad.cpp: Added.

(WebKit::PingLoad::PingLoad):
(WebKit::PingLoad::~PingLoad):
(WebKit::PingLoad::startNetworkLoad):
(WebKit::PingLoad::willPerformHTTPRedirection):
(WebKit::PingLoad::didReceiveChallenge):
(WebKit::PingLoad::didReceiveResponseNetworkSession):
(WebKit::PingLoad::didReceiveData):
(WebKit::PingLoad::didCompleteWithError):
(WebKit::PingLoad::didSendData):
(WebKit::PingLoad::wasBlocked):
(WebKit::PingLoad::cannotShowURL):
(WebKit::PingLoad::timeoutTimerFired):
(WebKit::PingLoad::needsCORSPreflight const):
(WebKit::PingLoad::doCORSPreflight):

  • NetworkProcess/PingLoad.h:
  • WebKit.xcodeproj/project.pbxproj:
  • WebProcess/Network/WebLoaderStrategy.cpp:

(WebKit::WebLoaderStrategy::createPingHandle):

  • WebProcess/Network/WebLoaderStrategy.h:

Source/WebKitLegacy:

createPingHandle() now takes new parameters but there is currently no behavior
change on WebKit1.

  • WebCoreSupport/WebResourceLoadScheduler.cpp:

(WebResourceLoadScheduler::createPingHandle):

  • WebCoreSupport/WebResourceLoadScheduler.h:

LayoutTests:

Add layout test coverage.

  • http/wpt/beacon/cors/cors-preflight-arraybufferview-failure-expected.txt: Added.
  • http/wpt/beacon/cors/cors-preflight-arraybufferview-failure.html: Added.
  • http/wpt/beacon/cors/cors-preflight-arraybufferview-success-expected.txt: Added.
  • http/wpt/beacon/cors/cors-preflight-arraybufferview-success.html: Added.
  • http/wpt/beacon/cors/cors-preflight-blob-failure-expected.txt: Added.
  • http/wpt/beacon/cors/cors-preflight-blob-failure.html: Added.
  • http/wpt/beacon/cors/cors-preflight-blob-success-expected.txt: Added.
  • http/wpt/beacon/cors/cors-preflight-blob-success.html: Added.
  • http/wpt/beacon/cors/cors-preflight-cookie-expected.txt: Added.
  • http/wpt/beacon/cors/cors-preflight-cookie.html: Added.
  • http/wpt/beacon/resources/beacon-preflight.py: Added.

(respondToCORSPreflight):
(main):

  • http/wpt/beacon/resources/set-cookie.py: Added.

(main):

  • platform/mac-wk1/TestExpectations:
  • platform/mac-wk2/TestExpectations:
  • platform/win/TestExpectations:
Location:
trunk
Files:
17 added
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r220436 r220442  
     12017-08-08  Chris Dumez  <cdumez@apple.com>
     2
     3        [Beacon] Add support for CORS-preflighting for WK2 / NETWORK_SESSION
     4        https://bugs.webkit.org/show_bug.cgi?id=175264
     5        <rdar://problem/33547793>
     6
     7        Reviewed by Youenn Fablet.
     8
     9        Add layout test coverage.
     10
     11        * http/wpt/beacon/cors/cors-preflight-arraybufferview-failure-expected.txt: Added.
     12        * http/wpt/beacon/cors/cors-preflight-arraybufferview-failure.html: Added.
     13        * http/wpt/beacon/cors/cors-preflight-arraybufferview-success-expected.txt: Added.
     14        * http/wpt/beacon/cors/cors-preflight-arraybufferview-success.html: Added.
     15        * http/wpt/beacon/cors/cors-preflight-blob-failure-expected.txt: Added.
     16        * http/wpt/beacon/cors/cors-preflight-blob-failure.html: Added.
     17        * http/wpt/beacon/cors/cors-preflight-blob-success-expected.txt: Added.
     18        * http/wpt/beacon/cors/cors-preflight-blob-success.html: Added.
     19        * http/wpt/beacon/cors/cors-preflight-cookie-expected.txt: Added.
     20        * http/wpt/beacon/cors/cors-preflight-cookie.html: Added.
     21        * http/wpt/beacon/resources/beacon-preflight.py: Added.
     22        (respondToCORSPreflight):
     23        (main):
     24        * http/wpt/beacon/resources/set-cookie.py: Added.
     25        (main):
     26        * platform/mac-wk1/TestExpectations:
     27        * platform/mac-wk2/TestExpectations:
     28        * platform/win/TestExpectations:
     29
    1302017-08-08  Devin Rousso  <drousso@apple.com>
    231
  • trunk/LayoutTests/platform/mac-wk1/TestExpectations

    r220428 r220442  
    361361webkit.org/b/170877 [ Debug ] webgl/1.0.2/conformance/glsl/misc/shader-with-reserved-words.html [ Pass Timeout ]
    362362
     363# CORS-preflighting for Beacon is not supported on WK1.
     364webkit.org/b/175330 http/wpt/beacon/cors/ [ Skip ]
     365
    363366# This was a WK2-only fix.
    364367http/tests/css/filters-on-iframes.html [ Skip ]
  • trunk/LayoutTests/platform/mac-wk2/TestExpectations

    r220419 r220442  
    723723webkit.org/b/172834 [ ElCapitan ] imported/w3c/web-platform-tests/IndexedDB/idbobjectstore_getAllKeys.html [ Pass Failure ]
    724724
     725
     726# CORS-preflighting for Beacon is not supported on WK2 for non NETWORK_SESSION code path.
     727webkit.org/b/175330 [ ElCapitan ] http/wpt/beacon/cors/ [ Skip ]
     728
    725729webkit.org/b/172201 webaudio/silent-audio-interrupted-in-background.html [ Pass Timeout ]
    726730
  • trunk/LayoutTests/platform/win/TestExpectations

    r220436 r220442  
    40484048webkit.org/b/174079 fast/text/variations/skia-postscript-name.html [ ImageOnlyFailure ]
    40494049
     4050# CORS-preflighting for Beacon is not supported on WK1.
     4051webkit.org/b/175330 http/wpt/beacon/cors/ [ Skip ]
     4052
    40504053# Async image tests are currently failing on Windows.
    40514054webkit.org/b/174653 fast/images/async-image-background-image-repeated.html [ Timeout ]
  • trunk/Source/WebCore/ChangeLog

    r220440 r220442  
     12017-08-08  Chris Dumez  <cdumez@apple.com>
     2
     3        [Beacon] Add support for CORS-preflighting for WK2 / NETWORK_SESSION
     4        https://bugs.webkit.org/show_bug.cgi?id=175264
     5        <rdar://problem/33547793>
     6
     7        Reviewed by Youenn Fablet.
     8
     9        Pass additional information when creating a PingHandle so that the PingLoad
     10        can deal with CORS-preflighting on Network process side.
     11
     12        Tests: http/wpt/beacon/cors/cors-preflight-arraybufferview-failure.html
     13               http/wpt/beacon/cors/cors-preflight-arraybufferview-success.html
     14               http/wpt/beacon/cors/cors-preflight-blob-failure.html
     15               http/wpt/beacon/cors/cors-preflight-blob-success.html
     16               http/wpt/beacon/cors/cors-preflight-cookie.html
     17
     18        * WebCore.xcodeproj/project.pbxproj:
     19        * loader/CrossOriginAccessControl.cpp:
     20        (WebCore::validatePreflightResponse):
     21        * loader/CrossOriginAccessControl.h:
     22        * loader/CrossOriginPreflightChecker.cpp:
     23        (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
     24        * loader/CrossOriginPreflightResultCache.h:
     25        * loader/LoaderStrategy.h:
     26        * loader/PingLoader.cpp:
     27        (WebCore::PingLoader::loadImage):
     28        (WebCore::PingLoader::sendPing):
     29        (WebCore::PingLoader::sendViolationReport):
     30        (WebCore::PingLoader::startPingLoad):
     31        * loader/PingLoader.h:
     32        * loader/cache/CachedResource.cpp:
     33        (WebCore::CachedResource::load):
     34        * page/SecurityOrigin.h:
     35
    1362017-08-08  Sam Weinig  <sam@webkit.org>
    237
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r220433 r220442  
    66436643                E1C415DA0F655D6F0092D2FB /* CrossOriginPreflightResultCache.h in Headers */ = {isa = PBXBuildFile; fileRef = E1C415D90F655D6F0092D2FB /* CrossOriginPreflightResultCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
    66446644                E1C415DE0F655D7C0092D2FB /* CrossOriginPreflightResultCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1C415DD0F655D7C0092D2FB /* CrossOriginPreflightResultCache.cpp */; };
    6645                 E1C416120F6562FD0092D2FB /* CrossOriginAccessControl.h in Headers */ = {isa = PBXBuildFile; fileRef = E1C416110F6562FD0092D2FB /* CrossOriginAccessControl.h */; };
     6645                E1C416120F6562FD0092D2FB /* CrossOriginAccessControl.h in Headers */ = {isa = PBXBuildFile; fileRef = E1C416110F6562FD0092D2FB /* CrossOriginAccessControl.h */; settings = {ATTRIBUTES = (Private, ); }; };
    66466646                E1C416170F6563180092D2FB /* CrossOriginAccessControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1C416160F6563180092D2FB /* CrossOriginAccessControl.cpp */; };
    66476647                E1C4DE690EA75C1E0023CCD6 /* ActiveDOMObject.h in Headers */ = {isa = PBXBuildFile; fileRef = E1C4DE680EA75C1E0023CCD6 /* ActiveDOMObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
  • trunk/Source/WebCore/loader/CrossOriginAccessControl.cpp

    r219595 r220442  
    2828#include "CrossOriginAccessControl.h"
    2929
     30#include "CrossOriginPreflightResultCache.h"
    3031#include "HTTPHeaderNames.h"
    3132#include "HTTPParsers.h"
     
    157158}
    158159
     160bool validatePreflightResponse(const ResourceRequest& request, const ResourceResponse& response, StoredCredentials includeCredentials, SecurityOrigin& securityOrigin, String& errorDescription)
     161{
     162    if (!response.isSuccessful()) {
     163        errorDescription = ASCIILiteral("Preflight response is not successful");
     164        return false;
     165    }
     166
     167    if (!passesAccessControlCheck(response, includeCredentials, securityOrigin, errorDescription))
     168        return false;
     169
     170    auto result = std::make_unique<CrossOriginPreflightResultCacheItem>(includeCredentials);
     171    if (!result->parse(response, errorDescription)
     172        || !result->allowsCrossOriginMethod(request.httpMethod(), errorDescription)
     173        || !result->allowsCrossOriginHeaders(request.httpHeaderFields(), errorDescription)) {
     174        return false;
     175    }
     176
     177    CrossOriginPreflightResultCache::singleton().appendEntry(securityOrigin.toString(), request.url(), WTFMove(result));
     178    return true;
     179}
     180
    159181} // namespace WebCore
  • trunk/Source/WebCore/loader/CrossOriginAccessControl.h

    r219595 r220442  
    4242
    4343void updateRequestForAccessControl(ResourceRequest&, SecurityOrigin&, StoredCredentials);
    44 ResourceRequest createAccessControlPreflightRequest(const ResourceRequest&, SecurityOrigin&, const String&);
     44WEBCORE_EXPORT ResourceRequest createAccessControlPreflightRequest(const ResourceRequest&, SecurityOrigin&, const String&);
    4545
    4646bool isValidCrossOriginRedirectionURL(const URL&);
    4747void cleanRedirectedRequestForAccessControl(ResourceRequest&);
    4848
    49 bool passesAccessControlCheck(const ResourceResponse&, StoredCredentials, SecurityOrigin&, String& errorDescription);
     49WEBCORE_EXPORT bool passesAccessControlCheck(const ResourceResponse&, StoredCredentials, SecurityOrigin&, String& errorDescription);
     50WEBCORE_EXPORT bool validatePreflightResponse(const ResourceRequest&, const ResourceResponse&, StoredCredentials, SecurityOrigin&, String& errorDescription);
    5051
    5152} // namespace WebCore
  • trunk/Source/WebCore/loader/CrossOriginPreflightChecker.cpp

    r219051 r220442  
    6161void CrossOriginPreflightChecker::validatePreflightResponse(DocumentThreadableLoader& loader, ResourceRequest&& request, unsigned long identifier, const ResourceResponse& response)
    6262{
    63     Frame* frame = loader.document().frame();
    64     ASSERT(frame);
    65 
    66     if (!response.isSuccessful()) {
    67         loader.preflightFailure(identifier, ResourceError(errorDomainWebKitInternal, 0, request.url(), ASCIILiteral("Preflight response is not successful"), ResourceError::Type::AccessControl));
     63    String errorDescription;
     64    if (!WebCore::validatePreflightResponse(request, response, loader.options().allowCredentials, loader.securityOrigin(), errorDescription)) {
     65        loader.preflightFailure(identifier, ResourceError(errorDomainWebKitInternal, 0, request.url(), errorDescription, ResourceError::Type::AccessControl));
    6866        return;
    6967    }
    7068
    71     String description;
    72     if (!passesAccessControlCheck(response, loader.options().allowCredentials, loader.securityOrigin(), description)) {
    73         loader.preflightFailure(identifier, ResourceError(errorDomainWebKitInternal, 0, request.url(), description, ResourceError::Type::AccessControl));
    74         return;
    75     }
    76 
    77     auto result = std::make_unique<CrossOriginPreflightResultCacheItem>(loader.options().allowCredentials);
    78     if (!result->parse(response, description)
    79         || !result->allowsCrossOriginMethod(request.httpMethod(), description)
    80         || !result->allowsCrossOriginHeaders(request.httpHeaderFields(), description)) {
    81         loader.preflightFailure(identifier, ResourceError(errorDomainWebKitInternal, 0, request.url(), description, ResourceError::Type::AccessControl));
    82         return;
    83     }
     69    Frame* frame = loader.document().frame();
     70    ASSERT(frame);
    8471
    8572    // FIXME: <https://webkit.org/b/164889> Web Inspector: Show Preflight Request information in inspector
     
    9077    InspectorInstrumentation::didFinishLoading(frame, frame->loader().documentLoader(), identifier, emptyMetrics, nullptr);
    9178
    92     CrossOriginPreflightResultCache::singleton().appendEntry(loader.securityOrigin().toString(), request.url(), WTFMove(result));
    9379    loader.preflightSuccess(WTFMove(request));
    9480}
  • trunk/Source/WebCore/loader/CrossOriginPreflightResultCache.h

    r208646 r220442  
    4747    }
    4848
    49     bool parse(const ResourceResponse&, String& errorDescription);
    50     bool allowsCrossOriginMethod(const String&, String& errorDescription) const;
    51     bool allowsCrossOriginHeaders(const HTTPHeaderMap&, String& errorDescription) const;
     49    WEBCORE_EXPORT bool parse(const ResourceResponse&, String& errorDescription);
     50    WEBCORE_EXPORT bool allowsCrossOriginMethod(const String&, String& errorDescription) const;
     51    WEBCORE_EXPORT bool allowsCrossOriginHeaders(const HTTPHeaderMap&, String& errorDescription) const;
    5252    bool allowsRequest(StoredCredentials, const String& method, const HTTPHeaderMap& requestHeaders) const;
    5353
     
    6868    WEBCORE_EXPORT static CrossOriginPreflightResultCache& singleton();
    6969
    70     void appendEntry(const String& origin, const URL&, std::unique_ptr<CrossOriginPreflightResultCacheItem>);
    71     bool canSkipPreflight(const String& origin, const URL&, StoredCredentials, const String& method, const HTTPHeaderMap& requestHeaders);
     70    WEBCORE_EXPORT void appendEntry(const String& origin, const URL&, std::unique_ptr<CrossOriginPreflightResultCacheItem>);
     71    WEBCORE_EXPORT bool canSkipPreflight(const String& origin, const URL&, StoredCredentials, const String& method, const HTTPHeaderMap& requestHeaders);
    7272
    7373    WEBCORE_EXPORT void empty();
  • trunk/Source/WebCore/loader/LoaderStrategy.h

    r215065 r220442  
    4343class ResourceRequest;
    4444class ResourceResponse;
     45class SecurityOrigin;
    4546class SharedBuffer;
    4647class SubresourceLoader;
    4748class URL;
     49
     50struct FetchOptions;
    4851
    4952class WEBCORE_EXPORT LoaderStrategy {
     
    6063    virtual void resumePendingRequests() = 0;
    6164
    62     virtual void createPingHandle(NetworkingContext*, ResourceRequest&, bool shouldUseCredentialStorage, bool shouldFollowRedirects) = 0;
     65    virtual void createPingHandle(NetworkingContext*, ResourceRequest&, Ref<SecurityOrigin>&& sourceOrigin, const FetchOptions&) = 0;
    6366
    6467    virtual void storeDerivedDataToCache(const SHA1::Digest& bodyKey, const String& type, const String& partition, WebCore::SharedBuffer&) = 0;
  • trunk/Source/WebCore/loader/PingLoader.cpp

    r220303 r220442  
    104104    frame.loader().addExtraFieldsToSubresourceRequest(request);
    105105
    106     startPingLoad(frame, request, ShouldFollowRedirects::Yes);
     106    startPingLoad(frame, request, document.securityOrigin(), ShouldFollowRedirects::Yes);
    107107}
    108108
     
    140140    }
    141141
    142     startPingLoad(frame, request, ShouldFollowRedirects::Yes);
     142    startPingLoad(frame, request, sourceOrigin, ShouldFollowRedirects::Yes);
    143143}
    144144
     
    177177        request.setHTTPReferrer(referrer);
    178178
    179     startPingLoad(frame, request, ShouldFollowRedirects::No);
    180 }
    181 
    182 void PingLoader::startPingLoad(Frame& frame, ResourceRequest& request, ShouldFollowRedirects shouldFollowRedirects)
     179    startPingLoad(frame, request, document.securityOrigin(), ShouldFollowRedirects::No);
     180}
     181
     182void PingLoader::startPingLoad(Frame& frame, ResourceRequest& request, SecurityOrigin& sourceOrigin, ShouldFollowRedirects shouldFollowRedirects)
    183183{
    184184    unsigned long identifier = frame.page()->progress().createUniqueIdentifier();
     
    189189    // DocumentLoader.
    190190    bool shouldUseCredentialStorage = frame.loader().client().shouldUseCredentialStorage(frame.loader().activeDocumentLoader(), identifier);
     191    FetchOptions options;
     192    options.credentials = shouldUseCredentialStorage ? FetchOptions::Credentials::Include : FetchOptions::Credentials::Omit;
     193    options.redirect = shouldFollowRedirects == ShouldFollowRedirects::Yes ? FetchOptions::Redirect::Follow : FetchOptions::Redirect::Error;
    191194
    192195    InspectorInstrumentation::continueAfterPingLoader(frame, identifier, frame.loader().activeDocumentLoader(), request, ResourceResponse());
    193196
    194     platformStrategies()->loaderStrategy()->createPingHandle(frame.loader().networkingContext(), request, shouldUseCredentialStorage, shouldFollowRedirects == ShouldFollowRedirects::Yes);
    195 }
    196 
    197 }
     197    platformStrategies()->loaderStrategy()->createPingHandle(frame.loader().networkingContext(), request, sourceOrigin, options);
     198}
     199
     200}
  • trunk/Source/WebCore/loader/PingLoader.h

    r220303 r220442  
    4242class URL;
    4343class ResourceRequest;
     44class SecurityOrigin;
    4445
    4546enum class ViolationReportType {
     
    5657private:
    5758    enum class ShouldFollowRedirects { No, Yes };
    58     static void startPingLoad(Frame&, ResourceRequest&, ShouldFollowRedirects);
     59    static void startPingLoad(Frame&, ResourceRequest&, SecurityOrigin& sourceOrigin, ShouldFollowRedirects);
    5960};
    6061
  • trunk/Source/WebCore/loader/cache/CachedResource.cpp

    r220320 r220442  
    262262    // FIXME: We should not special-case Beacon here.
    263263    if (m_options.keepAlive && type() == CachedResource::Beacon) {
    264         platformStrategies()->loaderStrategy()->createPingHandle(frame.loader().networkingContext(), request, m_options.credentials == FetchOptions::Credentials::Include, m_options.redirect == FetchOptions::Redirect::Follow);
     264        ASSERT(m_origin);
     265        platformStrategies()->loaderStrategy()->createPingHandle(frame.loader().networkingContext(), request, *m_origin, m_options);
    265266        return;
    266267    }
  • trunk/Source/WebCore/page/SecurityOrigin.h

    r218028 r220442  
    9898    // the given URL. For example, call this function before issuing
    9999    // XMLHttpRequests.
    100     bool canRequest(const URL&) const;
     100    WEBCORE_EXPORT bool canRequest(const URL&) const;
    101101
    102102    // Returns true if this SecurityOrigin can receive drag content from the
  • trunk/Source/WebKit/CMakeLists.txt

    r220403 r220442  
    101101    NetworkProcess/FileAPI/NetworkBlobRegistry.cpp
    102102
     103    NetworkProcess/NetworkCORSPreflightChecker.cpp
    103104    NetworkProcess/NetworkConnectionToWebProcess.cpp
    104105    NetworkProcess/NetworkDataTask.cpp
     
    112113    NetworkProcess/NetworkSession.cpp
    113114    NetworkProcess/NetworkSocketStream.cpp
     115    NetworkProcess/PingLoad.cpp
    114116
    115117    NetworkProcess/cache/NetworkCache.cpp
  • trunk/Source/WebKit/ChangeLog

    r220435 r220442  
     12017-08-08  Chris Dumez  <cdumez@apple.com>
     2
     3        [Beacon] Add support for CORS-preflighting for WK2 / NETWORK_SESSION
     4        https://bugs.webkit.org/show_bug.cgi?id=175264
     5        <rdar://problem/33547793>
     6
     7        Reviewed by Youenn Fablet.
     8
     9        Implement CORS-preflighting for beacons with a payload that has a non
     10        safelisted MIME type, as per:
     11        - https://w3c.github.io/beacon/#privacy
     12        - https://www.w3.org/TR/beacon/#sec-processing-model
     13
     14        CORS-preflighting is completely handled on Network Process side because
     15        a beacon request can outlive its page and therefore its WebContent
     16        process. This requires us to pass a little more information to the
     17        Network process, in particular the source origin and the corsMode.
     18
     19        The current implementation does not currently deal with CORS preflights
     20        needed upon a redirect. This will be added in a follow-up.
     21
     22        * CMakeLists.txt:
     23        * NetworkProcess/NetworkCORSPreflightChecker.cpp: Added.
     24        (WebKit::NetworkCORSPreflightChecker::NetworkCORSPreflightChecker):
     25        (WebKit::NetworkCORSPreflightChecker::~NetworkCORSPreflightChecker):
     26        (WebKit::NetworkCORSPreflightChecker::startPreflight):
     27        (WebKit::NetworkCORSPreflightChecker::willPerformHTTPRedirection):
     28        (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
     29        (WebKit::NetworkCORSPreflightChecker::didReceiveResponseNetworkSession):
     30        (WebKit::NetworkCORSPreflightChecker::didReceiveData):
     31        (WebKit::NetworkCORSPreflightChecker::didCompleteWithError):
     32        (WebKit::NetworkCORSPreflightChecker::didSendData):
     33        (WebKit::NetworkCORSPreflightChecker::wasBlocked):
     34        (WebKit::NetworkCORSPreflightChecker::cannotShowURL):
     35        * NetworkProcess/NetworkCORSPreflightChecker.h: Added.
     36        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
     37        (WebKit::NetworkConnectionToWebProcess::loadPing):
     38        * NetworkProcess/NetworkConnectionToWebProcess.h:
     39        * NetworkProcess/NetworkResourceLoadParameters.cpp:
     40        (WebKit::NetworkResourceLoadParameters::encode const):
     41        (WebKit::NetworkResourceLoadParameters::decode):
     42        * NetworkProcess/NetworkResourceLoadParameters.h:
     43        * NetworkProcess/PingLoad.cpp: Added.
     44        (WebKit::PingLoad::PingLoad):
     45        (WebKit::PingLoad::~PingLoad):
     46        (WebKit::PingLoad::startNetworkLoad):
     47        (WebKit::PingLoad::willPerformHTTPRedirection):
     48        (WebKit::PingLoad::didReceiveChallenge):
     49        (WebKit::PingLoad::didReceiveResponseNetworkSession):
     50        (WebKit::PingLoad::didReceiveData):
     51        (WebKit::PingLoad::didCompleteWithError):
     52        (WebKit::PingLoad::didSendData):
     53        (WebKit::PingLoad::wasBlocked):
     54        (WebKit::PingLoad::cannotShowURL):
     55        (WebKit::PingLoad::timeoutTimerFired):
     56        (WebKit::PingLoad::needsCORSPreflight const):
     57        (WebKit::PingLoad::doCORSPreflight):
     58        * NetworkProcess/PingLoad.h:
     59        * WebKit.xcodeproj/project.pbxproj:
     60        * WebProcess/Network/WebLoaderStrategy.cpp:
     61        (WebKit::WebLoaderStrategy::createPingHandle):
     62        * WebProcess/Network/WebLoaderStrategy.h:
     63
    1642017-08-08  Megan Gardner  <megan_gardner@apple.com>
    265
  • trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp

    r220267 r220442  
    223223}
    224224
    225 void NetworkConnectionToWebProcess::loadPing(const NetworkResourceLoadParameters& loadParameters)
     225void NetworkConnectionToWebProcess::loadPing(NetworkResourceLoadParameters&& loadParameters)
    226226{
    227227#if USE(NETWORK_SESSION)
    228228    // PingLoad manages its own lifetime, deleting itself when its purpose has been fulfilled.
    229     new PingLoad(loadParameters);
     229    new PingLoad(WTFMove(loadParameters));
    230230#else
    231231    RefPtr<NetworkingContext> context = RemoteNetworkingContext::create(loadParameters.sessionID, loadParameters.shouldClearReferrerOnHTTPSToHTTPRedirect);
  • trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h

    r219328 r220442  
    8383    void scheduleResourceLoad(const NetworkResourceLoadParameters&);
    8484    void performSynchronousLoad(const NetworkResourceLoadParameters&, Ref<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply>&&);
    85     void loadPing(const NetworkResourceLoadParameters&);
     85    void loadPing(NetworkResourceLoadParameters&&);
    8686    void prefetchDNS(const String&);
    8787
  • trunk/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp

    r210835 r220442  
    3030#include "DataReference.h"
    3131#include "WebCoreArgumentCoders.h"
     32#include <WebCore/SecurityOriginData.h>
    3233
    3334using namespace WebCore;
     
    8283    encoder << maximumBufferingTime;
    8384    encoder << derivedCachedDataTypesToRetrieve;
     85
     86    encoder << static_cast<bool>(sourceOrigin);
     87    if (sourceOrigin)
     88        encoder << SecurityOriginData::fromSecurityOrigin(*sourceOrigin);
     89    encoder.encodeEnum(mode);
    8490}
    8591
     
    146152        return false;
    147153
     154    bool hasSourceOrigin;
     155    if (!decoder.decode(hasSourceOrigin))
     156        return false;
     157    if (hasSourceOrigin) {
     158        SecurityOriginData sourceOriginData;
     159        if (!decoder.decode(sourceOriginData))
     160            return false;
     161        ASSERT(!sourceOriginData.isEmpty());
     162        result.sourceOrigin = sourceOriginData.securityOrigin();
     163    }
     164    if (!decoder.decodeEnum(result.mode))
     165        return false;
     166
    148167    return true;
    149168}
  • trunk/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.h

    r215152 r220442  
    2929#include "NetworkLoadParameters.h"
    3030#include "SandboxExtension.h"
     31#include <WebCore/FetchOptions.h>
    3132#include <WebCore/ResourceHandle.h>
    3233#include <WebCore/ResourceLoaderOptions.h>
    3334#include <WebCore/ResourceRequest.h>
     35#include <WebCore/SecurityOrigin.h>
    3436#include <WebCore/SessionID.h>
    3537#include <wtf/Seconds.h>
     
    5456    Seconds maximumBufferingTime;
    5557    Vector<String> derivedCachedDataTypesToRetrieve;
     58    RefPtr<WebCore::SecurityOrigin> sourceOrigin;
     59    WebCore::FetchOptions::Mode mode;
    5660};
    5761
  • trunk/Source/WebKit/NetworkProcess/PingLoad.h

    r215173 r220442  
    2424 */
    2525
    26 #ifndef PingLoad_h
    27 #define PingLoad_h
     26#pragma once
    2827
    29 #include "AuthenticationManager.h"
     28#if USE(NETWORK_SESSION)
     29
    3030#include "NetworkDataTask.h"
    31 #include "SessionTracker.h"
     31#include "NetworkResourceLoadParameters.h"
    3232
    3333namespace WebKit {
    3434
     35class NetworkCORSPreflightChecker;
     36
    3537class PingLoad final : private NetworkDataTaskClient {
    3638public:
    37     PingLoad(const NetworkResourceLoadParameters& parameters)
    38         : m_timeoutTimer(*this, &PingLoad::timeoutTimerFired)
    39         , m_shouldFollowRedirects(parameters.shouldFollowRedirects)
    40     {
    41         if (auto* networkSession = SessionTracker::networkSession(parameters.sessionID)) {
    42             m_task = NetworkDataTask::create(*networkSession, *this, parameters);
    43             m_task->resume();
    44         } else
    45             ASSERT_NOT_REACHED();
    46 
    47         // If the server never responds, this object will hang around forever.
    48         // Set a very generous timeout, just in case.
    49         m_timeoutTimer.startOneShot(60000_s);
    50     }
     39    explicit PingLoad(NetworkResourceLoadParameters&&);
    5140   
    5241private:
    53     void willPerformHTTPRedirection(WebCore::ResourceResponse&&, WebCore::ResourceRequest&& request, RedirectCompletionHandler&& completionHandler) final
    54     {
    55         completionHandler(m_shouldFollowRedirects ? request : WebCore::ResourceRequest());
    56     }
    57     void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&& completionHandler) final
    58     {
    59         completionHandler(AuthenticationChallengeDisposition::Cancel, { });
    60         delete this;
    61     }
    62     void didReceiveResponseNetworkSession(WebCore::ResourceResponse&&, ResponseCompletionHandler&& completionHandler) final
    63     {
    64         completionHandler(WebCore::PolicyAction::PolicyIgnore);
    65         delete this;
    66     }
    67     void didReceiveData(Ref<WebCore::SharedBuffer>&&) final { ASSERT_NOT_REACHED(); }
    68     void didCompleteWithError(const WebCore::ResourceError&, const WebCore::NetworkLoadMetrics&) final { delete this; }
    69     void didSendData(uint64_t totalBytesSent, uint64_t totalBytesExpectedToSend) final { }
    70     void wasBlocked() final { delete this; }
    71     void cannotShowURL() final { delete this; }
     42    ~PingLoad();
    7243
    73     void timeoutTimerFired() { delete this; }
     44    void willPerformHTTPRedirection(WebCore::ResourceResponse&&, WebCore::ResourceRequest&&, RedirectCompletionHandler&&) final;
     45    void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&&) final;
     46    void didReceiveResponseNetworkSession(WebCore::ResourceResponse&&, ResponseCompletionHandler&&) final;
     47    void didReceiveData(Ref<WebCore::SharedBuffer>&&) final;
     48    void didCompleteWithError(const WebCore::ResourceError&, const WebCore::NetworkLoadMetrics&) final;
     49    void didSendData(uint64_t totalBytesSent, uint64_t totalBytesExpectedToSend) final;
     50    void wasBlocked() final;
     51    void cannotShowURL() final;
     52    void timeoutTimerFired();
     53
     54    void startNetworkLoad();
     55    bool needsCORSPreflight(const WebCore::ResourceRequest&) const;
     56    void doCORSPreflight(const WebCore::ResourceRequest&);
    7457   
    75     virtual ~PingLoad()
    76     {
    77         if (m_task) {
    78             ASSERT(m_task->client() == this);
    79             m_task->clearClient();
    80             m_task->cancel();
    81         }
    82     }
    83    
     58    NetworkResourceLoadParameters m_parameters;
    8459    RefPtr<NetworkDataTask> m_task;
    8560    WebCore::Timer m_timeoutTimer;
    86     bool m_shouldFollowRedirects;
     61    std::unique_ptr<NetworkCORSPreflightChecker> m_corsPreflightChecker;
    8762};
    8863
    8964}
    9065
    91 #endif
     66#endif // USE(NETWORK_SESSION)
  • trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj

    r220275 r220442  
    903903                41FAF5F91E3C1025001AE678 /* LibWebRTCResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41FAF5F71E3C0B47001AE678 /* LibWebRTCResolver.cpp */; };
    904904                4450AEC01DC3FAE5009943F2 /* SharedMemoryCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4450AEBF1DC3FAE5009943F2 /* SharedMemoryCocoa.cpp */; };
     905                462107D81F38DBDB00DD7810 /* PingLoad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 462107D71F38DBD300DD7810 /* PingLoad.cpp */; };
    905906                463FD4801EB9459600A2982C /* WKProcessTerminationReason.h in Headers */ = {isa = PBXBuildFile; fileRef = 463FD47F1EB9458400A2982C /* WKProcessTerminationReason.h */; settings = {ATTRIBUTES = (Private, ); }; };
    906907                463FD4821EB94EC000A2982C /* ProcessTerminationReason.h in Headers */ = {isa = PBXBuildFile; fileRef = 463FD4811EB94EAD00A2982C /* ProcessTerminationReason.h */; };
     
    908909                46A2B6081E5676A600C3DEDA /* BackgroundProcessResponsivenessTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46A2B6061E5675A200C3DEDA /* BackgroundProcessResponsivenessTimer.cpp */; };
    909910                46A2B6091E5676A600C3DEDA /* BackgroundProcessResponsivenessTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 46A2B6071E5675A200C3DEDA /* BackgroundProcessResponsivenessTimer.h */; };
     911                46DF063B1F3905F8001980BB /* NetworkCORSPreflightChecker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46DF06391F3905E5001980BB /* NetworkCORSPreflightChecker.cpp */; };
     912                46DF063C1F3905F8001980BB /* NetworkCORSPreflightChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DF063A1F3905E5001980BB /* NetworkCORSPreflightChecker.h */; };
    910913                4A3CC18A19B063E700D14AEF /* UserMediaPermissionRequestManagerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A410F3919AF7B04002EBAB5 /* UserMediaPermissionRequestManagerProxy.cpp */; };
    911914                4A3CC18B19B0640F00D14AEF /* UserMediaPermissionRequestManagerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A410F3A19AF7B04002EBAB5 /* UserMediaPermissionRequestManagerProxy.h */; };
     
    31503153                41FAF5F71E3C0B47001AE678 /* LibWebRTCResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LibWebRTCResolver.cpp; path = Network/webrtc/LibWebRTCResolver.cpp; sourceTree = "<group>"; };
    31513154                4450AEBF1DC3FAE5009943F2 /* SharedMemoryCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SharedMemoryCocoa.cpp; path = cocoa/SharedMemoryCocoa.cpp; sourceTree = "<group>"; };
     3155                462107D71F38DBD300DD7810 /* PingLoad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PingLoad.cpp; path = NetworkProcess/PingLoad.cpp; sourceTree = "<group>"; };
    31523156                463FD47F1EB9458400A2982C /* WKProcessTerminationReason.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKProcessTerminationReason.h; sourceTree = "<group>"; };
    31533157                463FD4811EB94EAD00A2982C /* ProcessTerminationReason.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProcessTerminationReason.h; sourceTree = "<group>"; };
     
    31553159                46A2B6061E5675A200C3DEDA /* BackgroundProcessResponsivenessTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BackgroundProcessResponsivenessTimer.cpp; sourceTree = "<group>"; };
    31563160                46A2B6071E5675A200C3DEDA /* BackgroundProcessResponsivenessTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackgroundProcessResponsivenessTimer.h; sourceTree = "<group>"; };
     3161                46DF06391F3905E5001980BB /* NetworkCORSPreflightChecker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkCORSPreflightChecker.cpp; path = NetworkProcess/NetworkCORSPreflightChecker.cpp; sourceTree = "<group>"; };
     3162                46DF063A1F3905E5001980BB /* NetworkCORSPreflightChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkCORSPreflightChecker.h; path = NetworkProcess/NetworkCORSPreflightChecker.h; sourceTree = "<group>"; };
    31573163                4A410F3519AF7AC3002EBAB5 /* WKUserMediaPermissionRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKUserMediaPermissionRequest.cpp; sourceTree = "<group>"; };
    31583164                4A410F3619AF7AC3002EBAB5 /* WKUserMediaPermissionRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserMediaPermissionRequest.h; sourceTree = "<group>"; };
     
    59565962                                510CC7DC16138E2900D03ED3 /* mac */,
    59575963                                413075971DE84ED70039EC69 /* webrtc */,
     5964                                46DF06391F3905E5001980BB /* NetworkCORSPreflightChecker.cpp */,
     5965                                46DF063A1F3905E5001980BB /* NetworkCORSPreflightChecker.h */,
    59585966                                513A16491630A9BF005D7D22 /* NetworkConnectionToWebProcess.cpp */,
    59595967                                513A164A1630A9BF005D7D22 /* NetworkConnectionToWebProcess.h */,
     
    59855993                                5C0B177E1E7C886700E9123C /* NetworkSocketStream.h */,
    59865994                                5C0B177F1E7C886700E9123C /* NetworkSocketStream.messages.in */,
     5995                                462107D71F38DBD300DD7810 /* PingLoad.cpp */,
    59875996                                5CE85B1F1C88E6430070BFCE /* PingLoad.h */,
    59885997                                E1B78470163F24690007B692 /* RemoteNetworkingContext.h */,
     
    85798588                                E1B78471163F24690007B692 /* RemoteNetworkingContext.h in Headers */,
    85808589                                1A5704FC1BE1751100874AF1 /* RemoteObjectInvocation.h in Headers */,
     8590                                46DF063C1F3905F8001980BB /* NetworkCORSPreflightChecker.h in Headers */,
    85818591                                1AC1338018590AE400F3EC05 /* RemoteObjectRegistry.h in Headers */,
    85828592                                1AC1338618590C4600F3EC05 /* RemoteObjectRegistryMessages.h in Headers */,
     
    98619871                                E1A31735134CEA80007C9A4F /* AttributedString.mm in Sources */,
    98629872                                512F589612A8838800629530 /* AuthenticationChallengeProxy.cpp in Sources */,
     9873                                46DF063B1F3905F8001980BB /* NetworkCORSPreflightChecker.cpp in Sources */,
    98639874                                512F589812A8838800629530 /* AuthenticationDecisionListener.cpp in Sources */,
    98649875                                518E8EF816B2091C00E91429 /* AuthenticationManager.cpp in Sources */,
     
    1020110212                                51E35200180F5D0F00E53BE9 /* StorageToWebProcessConnection.cpp in Sources */,
    1020210213                                5118E9AC1F295977003EF9F5 /* StorageToWebProcessConnectionMessageReceiver.cpp in Sources */,
     10214                                462107D81F38DBDB00DD7810 /* PingLoad.cpp in Sources */,
    1020310215                                1AE00D6B18327C1200087DD7 /* StringReference.cpp in Sources */,
    1020410216                                296BD85E15019BC30071F424 /* StringUtilities.mm in Sources */,
  • trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp

    r220303 r220442  
    5151#include <WebCore/Document.h>
    5252#include <WebCore/DocumentLoader.h>
     53#include <WebCore/FetchOptions.h>
    5354#include <WebCore/Frame.h>
    5455#include <WebCore/FrameLoader.h>
     
    5758#include <WebCore/ReferrerPolicy.h>
    5859#include <WebCore/ResourceLoader.h>
     60#include <WebCore/SecurityOrigin.h>
    5961#include <WebCore/SessionID.h>
    6062#include <WebCore/Settings.h>
     
    384386}
    385387
    386 void WebLoaderStrategy::createPingHandle(NetworkingContext* networkingContext, ResourceRequest& request, bool shouldUseCredentialStorage, bool shouldFollowRedirects)
     388void WebLoaderStrategy::createPingHandle(NetworkingContext* networkingContext, ResourceRequest& request, Ref<SecurityOrigin>&& sourceOrigin, const FetchOptions& options)
    387389{
    388390    // It's possible that call to createPingHandle might be made during initial empty Document creation before a NetworkingContext exists.
     
    398400    NetworkResourceLoadParameters loadParameters;
    399401    loadParameters.request = request;
     402    loadParameters.sourceOrigin = WTFMove(sourceOrigin);
    400403    loadParameters.sessionID = webPage ? webPage->sessionID() : SessionID::defaultSessionID();
    401     loadParameters.allowStoredCredentials = shouldUseCredentialStorage ? AllowStoredCredentials : DoNotAllowStoredCredentials;
    402     loadParameters.shouldFollowRedirects = shouldFollowRedirects;
     404    loadParameters.allowStoredCredentials = options.credentials == FetchOptions::Credentials::Omit ? DoNotAllowStoredCredentials : AllowStoredCredentials;
     405    loadParameters.mode = options.mode;
     406    loadParameters.shouldFollowRedirects = options.redirect == FetchOptions::Redirect::Follow;
    403407    loadParameters.shouldClearReferrerOnHTTPSToHTTPRedirect = networkingContext->shouldClearReferrerOnHTTPSToHTTPRedirect();
    404408
  • trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h

    r216037 r220442  
    3232#include <wtf/RunLoop.h>
    3333
     34namespace WebCore {
     35struct FetchOptions;
     36}
     37
    3438namespace WebKit {
    3539
     
    5660    void resumePendingRequests() override;
    5761
    58     void createPingHandle(WebCore::NetworkingContext*, WebCore::ResourceRequest&, bool shouldUseCredentialStorage, bool shouldFollowRedirects) override;
     62    void createPingHandle(WebCore::NetworkingContext*, WebCore::ResourceRequest&, Ref<WebCore::SecurityOrigin>&& sourceOrigin, const WebCore::FetchOptions&) override;
    5963
    6064    void storeDerivedDataToCache(const SHA1::Digest& bodyHash, const String& type, const String& partition, WebCore::SharedBuffer&) override;
  • trunk/Source/WebKitLegacy/ChangeLog

    r220205 r220442  
     12017-08-08  Chris Dumez  <cdumez@apple.com>
     2
     3        [Beacon] Add support for CORS-preflighting for WK2 / NETWORK_SESSION
     4        https://bugs.webkit.org/show_bug.cgi?id=175264
     5        <rdar://problem/33547793>
     6
     7        Reviewed by Youenn Fablet.
     8
     9        createPingHandle() now takes new parameters but there is currently no behavior
     10        change on WebKit1.
     11
     12        * WebCoreSupport/WebResourceLoadScheduler.cpp:
     13        (WebResourceLoadScheduler::createPingHandle):
     14        * WebCoreSupport/WebResourceLoadScheduler.h:
     15
    1162017-08-03  Per Arne Vollan  <pvollan@apple.com>
    217
  • trunk/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.cpp

    r215160 r220442  
    2727#include <WebCore/Document.h>
    2828#include <WebCore/DocumentLoader.h>
     29#include <WebCore/FetchOptions.h>
    2930#include <WebCore/Frame.h>
    3031#include <WebCore/FrameLoader.h>
     
    363364}
    364365
    365 void WebResourceLoadScheduler::createPingHandle(NetworkingContext* networkingContext, ResourceRequest& request, bool shouldUseCredentialStorage, bool shouldFollowRedirects)
     366void WebResourceLoadScheduler::createPingHandle(NetworkingContext* networkingContext, ResourceRequest& request, Ref<SecurityOrigin>&&, const FetchOptions& options)
    366367{
    367368    // PingHandle manages its own lifetime, deleting itself when its purpose has been fulfilled.
    368     new PingHandle(networkingContext, request, shouldUseCredentialStorage, PingHandle::UsesAsyncCallbacks::No, shouldFollowRedirects);
    369 }
    370 
     369    new PingHandle(networkingContext, request, options.credentials != FetchOptions::Credentials::Omit, PingHandle::UsesAsyncCallbacks::No, options.redirect == FetchOptions::Redirect::Follow);
     370}
     371
  • trunk/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.h

    r215065 r220442  
    3838class WebResourceLoadScheduler;
    3939
     40namespace WebCore {
     41struct FetchOptions;
     42class SecurityOrigin;
     43}
     44
    4045WebResourceLoadScheduler& webResourceLoadScheduler();
    4146
     
    5560    void resumePendingRequests() override;
    5661
    57     void createPingHandle(WebCore::NetworkingContext*, WebCore::ResourceRequest&, bool shouldUseCredentialStorage, bool shouldFollowRedirects) override;
     62    void createPingHandle(WebCore::NetworkingContext*, WebCore::ResourceRequest&, Ref<WebCore::SecurityOrigin>&& sourceOrigin, const WebCore::FetchOptions&) override;
    5863
    5964    void storeDerivedDataToCache(const SHA1::Digest&, const String&, const String&, WebCore::SharedBuffer&) override { }
Note: See TracChangeset for help on using the changeset viewer.