WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
WIP Patch
175264_beacon_cors_preflight_wip.patch (text/plain), 29.78 KB, created by
Chris Dumez
on 2017-08-07 13:24:20 PDT
(
hide
)
Description:
WIP Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2017-08-07 13:24:20 PDT
Size:
29.78 KB
patch
obsolete
>diff --git a/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp b/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp >index 7208bcc81d4..50ea2ab7464 100644 >--- a/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp >+++ b/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp >@@ -28,7 +28,8 @@ > > #include "CachedResourceLoader.h" > #include "Document.h" >-#include "FetchRequest.h" >+#include "FetchBody.h" >+#include "HTTPParsers.h" > #include "Navigator.h" > #include "URL.h" > #include <runtime/JSCJSValue.h> >@@ -55,23 +56,28 @@ ExceptionOr<bool> NavigatorBeacon::sendBeacon(Navigator&, Document& document, co > return true; > } > >- FetchRequestInit init; >- init.method = ASCIILiteral("POST"); >- init.body = WTFMove(body); >- init.credentials = FetchOptions::Credentials::Include; >- init.cache = FetchOptions::Cache::NoCache; >- init.redirect = FetchOptions::Redirect::Follow; >- init.keepalive = true; >- init.window = JSC::jsNull(); >+ ResourceRequest request(parsedUrl); >+ request.setHTTPMethod(ASCIILiteral("POST")); > >- auto fetchRequestResult = FetchRequest::create(document, parsedUrl.string(), WTFMove(init)); >- if (fetchRequestResult.hasException()) >- return fetchRequestResult.releaseException(); >+ FetchOptions options; >+ options.credentials = FetchOptions::Credentials::Include; >+ options.redirect = FetchOptions::Redirect::Follow; >+ options.cache = FetchOptions::Cache::NoCache; >+ options.keepAlive = true; >+ if (body) { >+ options.mode = FetchOptions::Mode::Cors; >+ String mimeType; >+ auto fetchBody = FetchBody::extract(document, WTFMove(body.value()), mimeType); >+ request.setHTTPBody(fetchBody.bodyForInternalRequest(document)); >+ if (!mimeType.isEmpty()) { >+ request.setHTTPContentType(mimeType); >+ if (isCrossOriginSafeRequestHeader(HTTPHeaderName::ContentType, mimeType)) >+ options.mode = FetchOptions::Mode::NoCors; >+ } >+ } > >- auto fetchRequest = fetchRequestResult.releaseReturnValue(); >- document.cachedResourceLoader().requestBeaconResource({ fetchRequest->internalRequest(), fetchRequest->fetchOptions() }); >+ document.cachedResourceLoader().requestBeaconResource({ WTFMove(request), options }); > return true; > } > >-} >- >+} // namespace WebCore >diff --git a/Source/WebCore/loader/LoaderStrategy.h b/Source/WebCore/loader/LoaderStrategy.h >index 2871a21aa6b..863aa9c4dfb 100644 >--- a/Source/WebCore/loader/LoaderStrategy.h >+++ b/Source/WebCore/loader/LoaderStrategy.h >@@ -42,10 +42,13 @@ class ResourceError; > class ResourceLoader; > class ResourceRequest; > class ResourceResponse; >+class SecurityOrigin; > class SharedBuffer; > class SubresourceLoader; > class URL; > >+struct FetchOptions; >+ > class WEBCORE_EXPORT LoaderStrategy { > public: > virtual RefPtr<SubresourceLoader> loadResource(Frame&, CachedResource&, const ResourceRequest&, const ResourceLoaderOptions&) = 0; >@@ -59,7 +62,7 @@ public: > virtual void suspendPendingRequests() = 0; > virtual void resumePendingRequests() = 0; > >- virtual void createPingHandle(NetworkingContext*, ResourceRequest&, bool shouldUseCredentialStorage, bool shouldFollowRedirects) = 0; >+ virtual void createPingHandle(NetworkingContext*, ResourceRequest&, Ref<SecurityOrigin>&& sourceOrigin, const FetchOptions&) = 0; > > virtual void storeDerivedDataToCache(const SHA1::Digest& bodyKey, const String& type, const String& partition, WebCore::SharedBuffer&) = 0; > >diff --git a/Source/WebCore/loader/PingLoader.cpp b/Source/WebCore/loader/PingLoader.cpp >index 865eb1cdb80..89bbade6e5c 100644 >--- a/Source/WebCore/loader/PingLoader.cpp >+++ b/Source/WebCore/loader/PingLoader.cpp >@@ -103,7 +103,7 @@ void PingLoader::loadImage(Frame& frame, const URL& url) > request.setHTTPReferrer(referrer); > frame.loader().addExtraFieldsToSubresourceRequest(request); > >- startPingLoad(frame, request, ShouldFollowRedirects::Yes); >+ startPingLoad(frame, request, document.securityOrigin(), ShouldFollowRedirects::Yes); > } > > // http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#hyperlink-auditing >@@ -139,7 +139,7 @@ void PingLoader::sendPing(Frame& frame, const URL& pingURL, const URL& destinati > } > } > >- startPingLoad(frame, request, ShouldFollowRedirects::Yes); >+ startPingLoad(frame, request, sourceOrigin, ShouldFollowRedirects::Yes); > } > > void PingLoader::sendViolationReport(Frame& frame, const URL& reportURL, Ref<FormData>&& report, ViolationReportType reportType) >@@ -176,10 +176,10 @@ void PingLoader::sendViolationReport(Frame& frame, const URL& reportURL, Ref<For > if (!referrer.isEmpty()) > request.setHTTPReferrer(referrer); > >- startPingLoad(frame, request, ShouldFollowRedirects::No); >+ startPingLoad(frame, request, document.securityOrigin(), ShouldFollowRedirects::No); > } > >-void PingLoader::startPingLoad(Frame& frame, ResourceRequest& request, ShouldFollowRedirects shouldFollowRedirects) >+void PingLoader::startPingLoad(Frame& frame, ResourceRequest& request, SecurityOrigin& sourceOrigin, ShouldFollowRedirects shouldFollowRedirects) > { > unsigned long identifier = frame.page()->progress().createUniqueIdentifier(); > // FIXME: Why activeDocumentLoader? I would have expected documentLoader(). >@@ -188,10 +188,13 @@ void PingLoader::startPingLoad(Frame& frame, ResourceRequest& request, ShouldFol > // with the provisional DocumentLoader if there is a provisional > // DocumentLoader. > bool shouldUseCredentialStorage = frame.loader().client().shouldUseCredentialStorage(frame.loader().activeDocumentLoader(), identifier); >+ FetchOptions options; >+ options.credentials = shouldUseCredentialStorage ? FetchOptions::Credentials::Include : FetchOptions::Credentials::Omit; >+ options.redirect = shouldFollowRedirects == ShouldFollowRedirects::Yes ? FetchOptions::Redirect::Follow : FetchOptions::Redirect::Error; > > InspectorInstrumentation::continueAfterPingLoader(frame, identifier, frame.loader().activeDocumentLoader(), request, ResourceResponse()); > >- platformStrategies()->loaderStrategy()->createPingHandle(frame.loader().networkingContext(), request, shouldUseCredentialStorage, shouldFollowRedirects == ShouldFollowRedirects::Yes); >+ platformStrategies()->loaderStrategy()->createPingHandle(frame.loader().networkingContext(), request, sourceOrigin, options); > } > > } >diff --git a/Source/WebCore/loader/PingLoader.h b/Source/WebCore/loader/PingLoader.h >index b7937de209b..97354fb378e 100644 >--- a/Source/WebCore/loader/PingLoader.h >+++ b/Source/WebCore/loader/PingLoader.h >@@ -41,6 +41,7 @@ class FormData; > class Frame; > class URL; > class ResourceRequest; >+class SecurityOrigin; > > enum class ViolationReportType { > ContentSecurityPolicy, >@@ -55,7 +56,7 @@ public: > > private: > enum class ShouldFollowRedirects { No, Yes }; >- static void startPingLoad(Frame&, ResourceRequest&, ShouldFollowRedirects); >+ static void startPingLoad(Frame&, ResourceRequest&, SecurityOrigin& sourceOrigin, ShouldFollowRedirects); > }; > > } // namespace WebCore >diff --git a/Source/WebCore/loader/cache/CachedResource.cpp b/Source/WebCore/loader/cache/CachedResource.cpp >index 5fff7a9649b..ea6160aa5dd 100644 >--- a/Source/WebCore/loader/cache/CachedResource.cpp >+++ b/Source/WebCore/loader/cache/CachedResource.cpp >@@ -261,7 +261,8 @@ void CachedResource::load(CachedResourceLoader& cachedResourceLoader) > > // FIXME: We should not special-case Beacon here. > if (m_options.keepAlive && type() == CachedResource::Beacon) { >- platformStrategies()->loaderStrategy()->createPingHandle(frame.loader().networkingContext(), request, m_options.credentials == FetchOptions::Credentials::Include, m_options.redirect == FetchOptions::Redirect::Follow); >+ RELEASE_ASSERT(m_origin); >+ platformStrategies()->loaderStrategy()->createPingHandle(frame.loader().networkingContext(), request, *m_origin, m_options); > return; > } > >diff --git a/Source/WebCore/page/SecurityOrigin.h b/Source/WebCore/page/SecurityOrigin.h >index d56a6fff5d5..0ead4bc8b88 100644 >--- a/Source/WebCore/page/SecurityOrigin.h >+++ b/Source/WebCore/page/SecurityOrigin.h >@@ -97,7 +97,7 @@ public: > // Returns true if this SecurityOrigin can read content retrieved from > // the given URL. For example, call this function before issuing > // XMLHttpRequests. >- bool canRequest(const URL&) const; >+ WEBCORE_EXPORT bool canRequest(const URL&) const; > > // Returns true if this SecurityOrigin can receive drag content from the > // initiator. For example, call this function before allowing content to be >diff --git a/Source/WebKit/CMakeLists.txt b/Source/WebKit/CMakeLists.txt >index 06927f4032b..5b52447a4a1 100644 >--- a/Source/WebKit/CMakeLists.txt >+++ b/Source/WebKit/CMakeLists.txt >@@ -111,6 +111,7 @@ set(WebKit2_SOURCES > NetworkProcess/NetworkResourceLoader.cpp > NetworkProcess/NetworkSession.cpp > NetworkProcess/NetworkSocketStream.cpp >+ NetworkProcess/PingLoad.cpp > > NetworkProcess/cache/NetworkCache.cpp > NetworkProcess/cache/NetworkCacheBlobStorage.cpp >diff --git a/Source/WebKit/NetworkProcess/NetworkLoadParameters.h b/Source/WebKit/NetworkProcess/NetworkLoadParameters.h >index d064bebecea..8aaa9e5083f 100644 >--- a/Source/WebKit/NetworkProcess/NetworkLoadParameters.h >+++ b/Source/WebKit/NetworkProcess/NetworkLoadParameters.h >@@ -27,8 +27,10 @@ > #define NetworkLoadParameters_h > > #include <WebCore/BlobDataFileReference.h> >+#include <WebCore/FetchOptions.h> > #include <WebCore/ResourceLoaderOptions.h> > #include <WebCore/ResourceRequest.h> >+#include <WebCore/SecurityOrigin.h> > #include <WebCore/SessionID.h> > > namespace WebKit { >@@ -39,9 +41,11 @@ public: > uint64_t webFrameID { 0 }; > WebCore::SessionID sessionID { WebCore::SessionID::emptySessionID() }; > WebCore::ResourceRequest request; >+ RefPtr<WebCore::SecurityOrigin> sourceOrigin; > WebCore::ContentSniffingPolicy contentSniffingPolicy { WebCore::SniffContent }; > WebCore::StoredCredentials allowStoredCredentials { WebCore::DoNotAllowStoredCredentials }; > WebCore::ClientCredentialPolicy clientCredentialPolicy { WebCore::ClientCredentialPolicy::CannotAskClientForCredentials }; >+ WebCore::FetchOptions::Mode mode; > bool shouldFollowRedirects { true }; > bool shouldClearReferrerOnHTTPSToHTTPRedirect { true }; > bool defersLoading { false }; >diff --git a/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp b/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp >index 4e197c8eb25..61ab1985606 100644 >--- a/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp >@@ -29,6 +29,7 @@ > #include "ArgumentCoders.h" > #include "DataReference.h" > #include "WebCoreArgumentCoders.h" >+#include <WebCore/SecurityOriginData.h> > > using namespace WebCore; > >@@ -42,6 +43,10 @@ void NetworkResourceLoadParameters::encode(IPC::Encoder& encoder) const > encoder << sessionID; > encoder << request; > >+ encoder << static_cast<bool>(sourceOrigin); >+ if (sourceOrigin) >+ encoder << SecurityOriginData::fromSecurityOrigin(*sourceOrigin); >+ > encoder << static_cast<bool>(request.httpBody()); > if (request.httpBody()) { > request.httpBody()->encode(encoder); >@@ -75,6 +80,7 @@ void NetworkResourceLoadParameters::encode(IPC::Encoder& encoder) const > encoder.encodeEnum(contentSniffingPolicy); > encoder.encodeEnum(allowStoredCredentials); > encoder.encodeEnum(clientCredentialPolicy); >+ encoder.encodeEnum(mode); > encoder << shouldFollowRedirects; > encoder << shouldClearReferrerOnHTTPSToHTTPRedirect; > encoder << defersLoading; >@@ -100,6 +106,17 @@ bool NetworkResourceLoadParameters::decode(IPC::Decoder& decoder, NetworkResourc > if (!decoder.decode(result.request)) > return false; > >+ bool hasSourceOrigin; >+ if (!decoder.decode(hasSourceOrigin)) >+ return false; >+ if (hasSourceOrigin) { >+ SecurityOriginData sourceOriginData; >+ if (!decoder.decode(sourceOriginData)) >+ return false; >+ ASSERT(!sourceOriginData.isEmpty()); >+ result.sourceOrigin = sourceOriginData.securityOrigin(); >+ } >+ > bool hasHTTPBody; > if (!decoder.decode(hasHTTPBody)) > return false; >@@ -132,6 +149,8 @@ bool NetworkResourceLoadParameters::decode(IPC::Decoder& decoder, NetworkResourc > return false; > if (!decoder.decodeEnum(result.clientCredentialPolicy)) > return false; >+ if (!decoder.decodeEnum(result.mode)) >+ return false; > if (!decoder.decode(result.shouldFollowRedirects)) > return false; > if (!decoder.decode(result.shouldClearReferrerOnHTTPSToHTTPRedirect)) >diff --git a/Source/WebKit/NetworkProcess/PingLoad.cpp b/Source/WebKit/NetworkProcess/PingLoad.cpp >new file mode 100644 >index 00000000000..364295e92fb >--- /dev/null >+++ b/Source/WebKit/NetworkProcess/PingLoad.cpp >@@ -0,0 +1,111 @@ >+/* >+ * Copyright (C) 2016-2017 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "PingLoad.h" >+ >+namespace WebKit { >+ >+using namespace WebCore; >+ >+PingLoad::PingLoad(const NetworkResourceLoadParameters& parameters) >+ : m_parameters(parameters) >+ , m_timeoutTimer(*this, &PingLoad::timeoutTimerFired) >+{ >+ if (m_parameters.mode == FetchOptions::Mode::Cors) { >+ ASSERT(m_parameters.sourceOrigin); >+ if (!m_parameters.sourceOrigin->canRequest(m_parameters.request.url())) { >+ // FIXME: Do CORS preflight. >+ } >+ } >+ >+ if (auto* networkSession = SessionTracker::networkSession(parameters.sessionID)) { >+ m_task = NetworkDataTask::create(*networkSession, *this, parameters); >+ m_task->resume(); >+ } else >+ ASSERT_NOT_REACHED(); >+ >+ // If the server never responds, this object will hang around forever. >+ // Set a very generous timeout, just in case. >+ m_timeoutTimer.startOneShot(60000_s); >+} >+ >+PingLoad::~PingLoad() >+{ >+ if (m_task) { >+ ASSERT(m_task->client() == this); >+ m_task->clearClient(); >+ m_task->cancel(); >+ } >+} >+ >+void PingLoad::willPerformHTTPRedirection(ResourceResponse&&, ResourceRequest&& request, RedirectCompletionHandler&& completionHandler) >+{ >+ // FIXME: Do a CORS preflight if necessary. >+ completionHandler(m_parameters.shouldFollowRedirects ? request : ResourceRequest()); >+} >+ >+void PingLoad::didReceiveChallenge(const AuthenticationChallenge&, ChallengeCompletionHandler&& completionHandler) >+{ >+ completionHandler(AuthenticationChallengeDisposition::Cancel, { }); >+ delete this; >+} >+ >+void PingLoad::didReceiveResponseNetworkSession(ResourceResponse&&, ResponseCompletionHandler&& completionHandler) >+{ >+ completionHandler(PolicyAction::PolicyIgnore); >+ delete this; >+} >+ >+void PingLoad::didReceiveData(Ref<SharedBuffer>&&) >+{ >+ ASSERT_NOT_REACHED(); >+} >+ >+void PingLoad::didCompleteWithError(const ResourceError&, const NetworkLoadMetrics&) >+{ >+ delete this; >+} >+ >+void PingLoad::didSendData(uint64_t totalBytesSent, uint64_t totalBytesExpectedToSend) >+{ >+} >+ >+void PingLoad::wasBlocked() >+{ >+ delete this; >+} >+ >+void PingLoad::cannotShowURL() >+{ >+ delete this; >+} >+ >+void PingLoad::timeoutTimerFired() >+{ >+ delete this; >+} >+ >+} // namespace WebKit >diff --git a/Source/WebKit/NetworkProcess/PingLoad.h b/Source/WebKit/NetworkProcess/PingLoad.h >index 39be06d3e1b..49a2a9b52e1 100644 >--- a/Source/WebKit/NetworkProcess/PingLoad.h >+++ b/Source/WebKit/NetworkProcess/PingLoad.h >@@ -23,69 +23,35 @@ > * THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#ifndef PingLoad_h >-#define PingLoad_h >+#pragma once > > #include "AuthenticationManager.h" > #include "NetworkDataTask.h" >+#include "NetworkResourceLoadParameters.h" > #include "SessionTracker.h" > > namespace WebKit { > > class PingLoad final : private NetworkDataTaskClient { > public: >- PingLoad(const NetworkResourceLoadParameters& parameters) >- : m_timeoutTimer(*this, &PingLoad::timeoutTimerFired) >- , m_shouldFollowRedirects(parameters.shouldFollowRedirects) >- { >- if (auto* networkSession = SessionTracker::networkSession(parameters.sessionID)) { >- m_task = NetworkDataTask::create(*networkSession, *this, parameters); >- m_task->resume(); >- } else >- ASSERT_NOT_REACHED(); >- >- // If the server never responds, this object will hang around forever. >- // Set a very generous timeout, just in case. >- m_timeoutTimer.startOneShot(60000_s); >- } >+ explicit PingLoad(const NetworkResourceLoadParameters&); > > private: >- void willPerformHTTPRedirection(WebCore::ResourceResponse&&, WebCore::ResourceRequest&& request, RedirectCompletionHandler&& completionHandler) final >- { >- completionHandler(m_shouldFollowRedirects ? request : WebCore::ResourceRequest()); >- } >- void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&& completionHandler) final >- { >- completionHandler(AuthenticationChallengeDisposition::Cancel, { }); >- delete this; >- } >- void didReceiveResponseNetworkSession(WebCore::ResourceResponse&&, ResponseCompletionHandler&& completionHandler) final >- { >- completionHandler(WebCore::PolicyAction::PolicyIgnore); >- delete this; >- } >- void didReceiveData(Ref<WebCore::SharedBuffer>&&) final { ASSERT_NOT_REACHED(); } >- void didCompleteWithError(const WebCore::ResourceError&, const WebCore::NetworkLoadMetrics&) final { delete this; } >- void didSendData(uint64_t totalBytesSent, uint64_t totalBytesExpectedToSend) final { } >- void wasBlocked() final { delete this; } >- void cannotShowURL() final { delete this; } >- >- void timeoutTimerFired() { delete this; } >- >- virtual ~PingLoad() >- { >- if (m_task) { >- ASSERT(m_task->client() == this); >- m_task->clearClient(); >- m_task->cancel(); >- } >- } >+ ~PingLoad(); >+ >+ void willPerformHTTPRedirection(WebCore::ResourceResponse&&, WebCore::ResourceRequest&&, RedirectCompletionHandler&&) final; >+ void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&&) final; >+ void didReceiveResponseNetworkSession(WebCore::ResourceResponse&&, ResponseCompletionHandler&&) final; >+ void didReceiveData(Ref<WebCore::SharedBuffer>&&) final; >+ void didCompleteWithError(const WebCore::ResourceError&, const WebCore::NetworkLoadMetrics&) final; >+ void didSendData(uint64_t totalBytesSent, uint64_t totalBytesExpectedToSend) final; >+ void wasBlocked() final; >+ void cannotShowURL() final; >+ void timeoutTimerFired(); > >+ NetworkResourceLoadParameters m_parameters; > RefPtr<NetworkDataTask> m_task; > WebCore::Timer m_timeoutTimer; >- bool m_shouldFollowRedirects; > }; > > } >- >-#endif >diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >index 217710d24cf..c87599f53c8 100644 >--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj >+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >@@ -902,6 +902,7 @@ > 41FAF5F81E3C1021001AE678 /* LibWebRTCResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FAF5F61E3C0B47001AE678 /* LibWebRTCResolver.h */; }; > 41FAF5F91E3C1025001AE678 /* LibWebRTCResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41FAF5F71E3C0B47001AE678 /* LibWebRTCResolver.cpp */; }; > 4450AEC01DC3FAE5009943F2 /* SharedMemoryCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4450AEBF1DC3FAE5009943F2 /* SharedMemoryCocoa.cpp */; }; >+ 462107D81F38DBDB00DD7810 /* PingLoad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 462107D71F38DBD300DD7810 /* PingLoad.cpp */; }; > 463FD4801EB9459600A2982C /* WKProcessTerminationReason.h in Headers */ = {isa = PBXBuildFile; fileRef = 463FD47F1EB9458400A2982C /* WKProcessTerminationReason.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 463FD4821EB94EC000A2982C /* ProcessTerminationReason.h in Headers */ = {isa = PBXBuildFile; fileRef = 463FD4811EB94EAD00A2982C /* ProcessTerminationReason.h */; }; > 465250E61ECF52DC002025CB /* WebKit2InitializeCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 465250E51ECF52CD002025CB /* WebKit2InitializeCocoa.mm */; }; >@@ -3149,6 +3150,7 @@ > 41FAF5F61E3C0B47001AE678 /* LibWebRTCResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCResolver.h; path = Network/webrtc/LibWebRTCResolver.h; sourceTree = "<group>"; }; > 41FAF5F71E3C0B47001AE678 /* LibWebRTCResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LibWebRTCResolver.cpp; path = Network/webrtc/LibWebRTCResolver.cpp; sourceTree = "<group>"; }; > 4450AEBF1DC3FAE5009943F2 /* SharedMemoryCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SharedMemoryCocoa.cpp; path = cocoa/SharedMemoryCocoa.cpp; sourceTree = "<group>"; }; >+ 462107D71F38DBD300DD7810 /* PingLoad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PingLoad.cpp; path = NetworkProcess/PingLoad.cpp; sourceTree = "<group>"; }; > 463FD47F1EB9458400A2982C /* WKProcessTerminationReason.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKProcessTerminationReason.h; sourceTree = "<group>"; }; > 463FD4811EB94EAD00A2982C /* ProcessTerminationReason.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProcessTerminationReason.h; sourceTree = "<group>"; }; > 465250E51ECF52CD002025CB /* WebKit2InitializeCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebKit2InitializeCocoa.mm; sourceTree = "<group>"; }; >@@ -5984,6 +5986,7 @@ > 5C0B177D1E7C886700E9123C /* NetworkSocketStream.cpp */, > 5C0B177E1E7C886700E9123C /* NetworkSocketStream.h */, > 5C0B177F1E7C886700E9123C /* NetworkSocketStream.messages.in */, >+ 462107D71F38DBD300DD7810 /* PingLoad.cpp */, > 5CE85B1F1C88E6430070BFCE /* PingLoad.h */, > E1B78470163F24690007B692 /* RemoteNetworkingContext.h */, > ); >@@ -10200,6 +10203,7 @@ > 51E35209180F5D6B00E53BE9 /* StorageServiceEntryPoint.mm in Sources */, > 51E35200180F5D0F00E53BE9 /* StorageToWebProcessConnection.cpp in Sources */, > 5118E9AC1F295977003EF9F5 /* StorageToWebProcessConnectionMessageReceiver.cpp in Sources */, >+ 462107D81F38DBDB00DD7810 /* PingLoad.cpp in Sources */, > 1AE00D6B18327C1200087DD7 /* StringReference.cpp in Sources */, > 296BD85E15019BC30071F424 /* StringUtilities.mm in Sources */, > 1ZZ417EF12C00D87002BE67B /* TextCheckerCompletion.cpp in Sources */, >diff --git a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp >index 20253cc3e5a..c16d08bb7fc 100644 >--- a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp >+++ b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp >@@ -50,12 +50,14 @@ > #include <WebCore/DiagnosticLoggingKeys.h> > #include <WebCore/Document.h> > #include <WebCore/DocumentLoader.h> >+#include <WebCore/FetchOptions.h> > #include <WebCore/Frame.h> > #include <WebCore/FrameLoader.h> > #include <WebCore/NetscapePlugInStreamLoader.h> > #include <WebCore/PlatformStrategies.h> > #include <WebCore/ReferrerPolicy.h> > #include <WebCore/ResourceLoader.h> >+#include <WebCore/SecurityOrigin.h> > #include <WebCore/SessionID.h> > #include <WebCore/Settings.h> > #include <WebCore/SubresourceLoader.h> >@@ -383,7 +385,7 @@ void WebLoaderStrategy::loadResourceSynchronously(NetworkingContext* context, un > } > } > >-void WebLoaderStrategy::createPingHandle(NetworkingContext* networkingContext, ResourceRequest& request, bool shouldUseCredentialStorage, bool shouldFollowRedirects) >+void WebLoaderStrategy::createPingHandle(NetworkingContext* networkingContext, ResourceRequest& request, Ref<SecurityOrigin>&& sourceOrigin, const FetchOptions& options) > { > // It's possible that call to createPingHandle might be made during initial empty Document creation before a NetworkingContext exists. > // It is not clear that we should send ping loads during that process anyways. >@@ -397,9 +399,11 @@ void WebLoaderStrategy::createPingHandle(NetworkingContext* networkingContext, R > > NetworkResourceLoadParameters loadParameters; > loadParameters.request = request; >+ loadParameters.sourceOrigin = WTFMove(sourceOrigin); > loadParameters.sessionID = webPage ? webPage->sessionID() : SessionID::defaultSessionID(); >- loadParameters.allowStoredCredentials = shouldUseCredentialStorage ? AllowStoredCredentials : DoNotAllowStoredCredentials; >- loadParameters.shouldFollowRedirects = shouldFollowRedirects; >+ loadParameters.allowStoredCredentials = options.credentials == FetchOptions::Credentials::Omit ? DoNotAllowStoredCredentials : AllowStoredCredentials; >+ loadParameters.mode = options.mode; >+ loadParameters.shouldFollowRedirects = options.redirect == FetchOptions::Redirect::Follow; > loadParameters.shouldClearReferrerOnHTTPSToHTTPRedirect = networkingContext->shouldClearReferrerOnHTTPSToHTTPRedirect(); > > WebProcess::singleton().networkConnection().connection().send(Messages::NetworkConnectionToWebProcess::LoadPing(loadParameters), 0); >diff --git a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h >index 947843b40f5..bfc10746fc4 100644 >--- a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h >+++ b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h >@@ -31,6 +31,10 @@ > #include <wtf/HashSet.h> > #include <wtf/RunLoop.h> > >+namespace WebCore { >+struct FetchOptions; >+} >+ > namespace WebKit { > > class NetworkProcessConnection; >@@ -55,7 +59,7 @@ public: > void suspendPendingRequests() override; > void resumePendingRequests() override; > >- void createPingHandle(WebCore::NetworkingContext*, WebCore::ResourceRequest&, bool shouldUseCredentialStorage, bool shouldFollowRedirects) override; >+ void createPingHandle(WebCore::NetworkingContext*, WebCore::ResourceRequest&, Ref<WebCore::SecurityOrigin>&& sourceOrigin, const WebCore::FetchOptions&) override; > > void storeDerivedDataToCache(const SHA1::Digest& bodyHash, const String& type, const String& partition, WebCore::SharedBuffer&) override; > >diff --git a/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.cpp b/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.cpp >index 2c7be1a4d76..479776ec9d2 100644 >--- a/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.cpp >+++ b/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.cpp >@@ -26,6 +26,7 @@ > > #include <WebCore/Document.h> > #include <WebCore/DocumentLoader.h> >+#include <WebCore/FetchOptions.h> > #include <WebCore/Frame.h> > #include <WebCore/FrameLoader.h> > #include <WebCore/NetscapePlugInStreamLoader.h> >@@ -362,9 +363,9 @@ bool WebResourceLoadScheduler::HostInformation::limitRequests(ResourceLoadPriori > return m_requestsLoading.size() >= (webResourceLoadScheduler().isSerialLoadingEnabled() ? 1 : m_maxRequestsInFlight); > } > >-void WebResourceLoadScheduler::createPingHandle(NetworkingContext* networkingContext, ResourceRequest& request, bool shouldUseCredentialStorage, bool shouldFollowRedirects) >+void WebResourceLoadScheduler::createPingHandle(NetworkingContext* networkingContext, ResourceRequest& request, Ref<SecurityOrigin>&&, const FetchOptions& options) > { > // PingHandle manages its own lifetime, deleting itself when its purpose has been fulfilled. >- new PingHandle(networkingContext, request, shouldUseCredentialStorage, PingHandle::UsesAsyncCallbacks::No, shouldFollowRedirects); >+ new PingHandle(networkingContext, request, options.credentials != FetchOptions::Credentials::Omit, PingHandle::UsesAsyncCallbacks::No, options.redirect == FetchOptions::Redirect::Follow); > } > >diff --git a/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.h b/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.h >index 076a334d9cc..60970bb4fbb 100644 >--- a/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.h >+++ b/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.h >@@ -37,6 +37,11 @@ > > class WebResourceLoadScheduler; > >+namespace WebCore { >+struct FetchOptions; >+class SecurityOrigin; >+} >+ > WebResourceLoadScheduler& webResourceLoadScheduler(); > > class WebResourceLoadScheduler : public WebCore::LoaderStrategy { >@@ -54,7 +59,7 @@ public: > void suspendPendingRequests() override; > void resumePendingRequests() override; > >- void createPingHandle(WebCore::NetworkingContext*, WebCore::ResourceRequest&, bool shouldUseCredentialStorage, bool shouldFollowRedirects) override; >+ void createPingHandle(WebCore::NetworkingContext*, WebCore::ResourceRequest&, Ref<WebCore::SecurityOrigin>&& sourceOrigin, const WebCore::FetchOptions&) override; > > void storeDerivedDataToCache(const SHA1::Digest&, const String&, const String&, WebCore::SharedBuffer&) override { } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 175264
:
317456
|
317457
|
317477
|
317478
|
317484
|
317499
|
317501
|
317539
|
317544
|
317580
|
317595
|
317607
|
317645
|
317655
|
317659
|
317660
|
317668
|
317670