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
175723_beacon_error_reporting_wip.patch (text/plain), 29.14 KB, created by
Chris Dumez
on 2017-08-18 13:32:16 PDT
(
hide
)
Description:
WIP Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2017-08-18 13:32:16 PDT
Size:
29.14 KB
patch
obsolete
>diff --git a/LayoutTests/http/wpt/beacon/beacon-async-error-logging-expected.txt b/LayoutTests/http/wpt/beacon/beacon-async-error-logging-expected.txt >new file mode 100644 >index 00000000000..82008d97f37 >--- /dev/null >+++ b/LayoutTests/http/wpt/beacon/beacon-async-error-logging-expected.txt >@@ -0,0 +1,4 @@ >+CONSOLE MESSAGE: Beacon API cannot load http://invalid.localhost/. A server with the specified hostname could not be found. >+ >+PASS Should log an error message in the console >+ >diff --git a/LayoutTests/http/wpt/beacon/beacon-async-error-logging.html b/LayoutTests/http/wpt/beacon/beacon-async-error-logging.html >new file mode 100644 >index 00000000000..c276cfe5081 >--- /dev/null >+++ b/LayoutTests/http/wpt/beacon/beacon-async-error-logging.html >@@ -0,0 +1,18 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<script> >+ async_test(function(t) { >+ let invalidHost = "http://invalid.localhost"; >+ assert_true(navigator.sendBeacon(invalidHost, 'test'), "sendBeacon should return true"); >+ setTimeout(function() { >+ t.done(); >+ }, 500); >+ }, "Should log an error message in the console"); >+</script> >+</body> >+</html> >diff --git a/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp b/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp >index 1fa1f412671..047e453e170 100644 >--- a/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp >+++ b/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp >@@ -26,16 +26,80 @@ > #include "config.h" > #include "NavigatorBeacon.h" > >+#include "CachedRawResource.h" > #include "CachedResourceLoader.h" > #include "Document.h" > #include "FetchBody.h" >+#include "Frame.h" > #include "HTTPParsers.h" > #include "Navigator.h" > #include "URL.h" > > namespace WebCore { > >-ExceptionOr<bool> NavigatorBeacon::sendBeacon(Navigator&, Document& document, const String& url, std::optional<FetchBody::Init>&& body) >+NavigatorBeacon::NavigatorBeacon(Navigator& navigator) >+ : m_navigator(navigator) >+{ >+} >+ >+NavigatorBeacon::~NavigatorBeacon() >+{ >+ auto inflightBeacons = WTFMove(m_inflightBeacons); >+ for (auto& beacon : inflightBeacons) >+ beacon->removeClient(*this); >+} >+ >+NavigatorBeacon* NavigatorBeacon::from(Navigator* navigator) >+{ >+ NavigatorBeacon* supplement = static_cast<NavigatorBeacon*>(Supplement<Navigator>::from(navigator, supplementName())); >+ if (!supplement) { >+ auto newSupplement = std::make_unique<NavigatorBeacon>(*navigator); >+ supplement = newSupplement.get(); >+ provideTo(navigator, supplementName(), WTFMove(newSupplement)); >+ } >+ return supplement; >+} >+ >+const char* NavigatorBeacon::supplementName() >+{ >+ return "NavigatorBeacon"; >+} >+ >+void NavigatorBeacon::notifyFinished(CachedResource& resource) >+{ >+ if (!resource.resourceError().isNull()) >+ logError(resource.resourceError()); >+ >+ resource.removeClient(*this); >+ bool wasRemoved = m_inflightBeacons.removeFirst(&resource); >+ ASSERT_UNUSED(wasRemoved, wasRemoved); >+} >+ >+void NavigatorBeacon::logError(const ResourceError& error) >+{ >+ ASSERT(!error.isNull()); >+ >+ auto* frame = m_navigator.frame(); >+ if (!frame) >+ return; >+ >+ auto* document = frame->document(); >+ if (!document) >+ return; >+ >+ const char* messageMiddle = ". "; >+ String description = error.localizedDescription(); >+ if (description.isEmpty()) { >+ if (error.isAccessControl()) >+ messageMiddle = ASCIILiteral(" due to access control checks."); >+ else >+ messageMiddle = "."; >+ } >+ >+ document->addConsoleMessage(MessageSource::Network, MessageLevel::Error, makeString("Beacon API cannot load ", error.failingURL().string(), messageMiddle, description)); >+} >+ >+ExceptionOr<bool> NavigatorBeacon::sendBeacon(Document& document, const String& url, std::optional<FetchBody::Init>&& body) > { > URL parsedUrl = document.completeURL(url); > >@@ -73,12 +137,21 @@ ExceptionOr<bool> NavigatorBeacon::sendBeacon(Navigator&, Document& document, co > options.mode = FetchOptions::Mode::NoCors; > } > } >+ > auto cachedResource = document.cachedResourceLoader().requestBeaconResource({ WTFMove(request), options }); >- if (cachedResource) >- return true; >+ if (!cachedResource) { >+ document.addConsoleMessage(MessageSource::Network, MessageLevel::Error, cachedResource.error().localizedDescription()); >+ return false; >+ } >+ >+ m_inflightBeacons.append(cachedResource.value().get()); >+ cachedResource.value()->addClient(*this); >+ return true; >+} > >- document.addConsoleMessage(MessageSource::Network, MessageLevel::Error, cachedResource.error().localizedDescription()); >- return false; >+ExceptionOr<bool> NavigatorBeacon::sendBeacon(Navigator& navigator, Document& document, const String& url, std::optional<FetchBody::Init>&& body) >+{ >+ return NavigatorBeacon::from(&navigator)->sendBeacon(document, url, WTFMove(body)); > } > > } >diff --git a/Source/WebCore/Modules/beacon/NavigatorBeacon.h b/Source/WebCore/Modules/beacon/NavigatorBeacon.h >index 6fdf89dd5ae..e37f9ae7f59 100644 >--- a/Source/WebCore/Modules/beacon/NavigatorBeacon.h >+++ b/Source/WebCore/Modules/beacon/NavigatorBeacon.h >@@ -25,18 +25,38 @@ > > #pragma once > >+#include "CachedRawResourceClient.h" >+#include "CachedResourceHandle.h" > #include "ExceptionOr.h" > #include "FetchBody.h" >+#include "Supplementable.h" > #include <wtf/Forward.h> > > namespace WebCore { > >+class CachedRawResource; > class Document; > class Navigator; >+class ResourceError; > >-class NavigatorBeacon { >+class NavigatorBeacon final : public Supplement<Navigator>, private CachedRawResourceClient { > public: >+ explicit NavigatorBeacon(Navigator&); >+ ~NavigatorBeacon(); > static ExceptionOr<bool> sendBeacon(Navigator&, Document&, const String& url, std::optional<FetchBody::Init>&&); >+ >+private: >+ ExceptionOr<bool> sendBeacon(Document&, const String& url, std::optional<FetchBody::Init>&&); >+ >+ static NavigatorBeacon* from(Navigator*); >+ static const char* supplementName(); >+ >+ // CachedRawResourceClient >+ void notifyFinished(CachedResource&) final; >+ void logError(const ResourceError&); >+ >+ Navigator& m_navigator; >+ Vector<CachedResourceHandle<CachedRawResource>> m_inflightBeacons; > }; > > } >diff --git a/Source/WebCore/loader/LoaderStrategy.h b/Source/WebCore/loader/LoaderStrategy.h >index b64293475cd..736813706b5 100644 >--- a/Source/WebCore/loader/LoaderStrategy.h >+++ b/Source/WebCore/loader/LoaderStrategy.h >@@ -64,7 +64,8 @@ public: > virtual void suspendPendingRequests() = 0; > virtual void resumePendingRequests() = 0; > >- virtual void startPingLoad(NetworkingContext*, ResourceRequest&, const HTTPHeaderMap& originalRequestHeaders, Ref<SecurityOrigin>&& sourceOrigin, ContentSecurityPolicy*, const FetchOptions&, WTF::Function<void()>&& completionHandler = { }) = 0; >+ using PingLoadCompletionHandler = WTF::Function<void(ResourceError&&)>; >+ virtual void startPingLoad(NetworkingContext*, ResourceRequest&, const HTTPHeaderMap& originalRequestHeaders, Ref<SecurityOrigin>&& sourceOrigin, ContentSecurityPolicy*, const FetchOptions&, PingLoadCompletionHandler&& = { }) = 0; > > virtual void storeDerivedDataToCache(const SHA1::Digest& bodyKey, const String& type, const String& partition, WebCore::SharedBuffer&) = 0; > >diff --git a/Source/WebCore/loader/cache/CachedResource.cpp b/Source/WebCore/loader/cache/CachedResource.cpp >index 829cd9be561..5513543a56c 100644 >--- a/Source/WebCore/loader/cache/CachedResource.cpp >+++ b/Source/WebCore/loader/cache/CachedResource.cpp >@@ -274,8 +274,13 @@ void CachedResource::load(CachedResourceLoader& cachedResourceLoader) > auto* contentSecurityPolicy = document && !document->shouldBypassMainWorldContentSecurityPolicy() ? document->contentSecurityPolicy() : nullptr; > ASSERT(m_originalRequestHeaders); > CachedResourceHandle<CachedResource> protectedThis(this); >- platformStrategies()->loaderStrategy()->startPingLoad(frame.loader().networkingContext(), request, *m_originalRequestHeaders, *m_origin, contentSecurityPolicy, m_options, [this, protectedThis = WTFMove(protectedThis)] { >- finishLoading(nullptr); >+ platformStrategies()->loaderStrategy()->startPingLoad(frame.loader().networkingContext(), request, *m_originalRequestHeaders, *m_origin, contentSecurityPolicy, m_options, [this, protectedThis = WTFMove(protectedThis)] (ResourceError&& error) { >+ if (error.isNull()) >+ finishLoading(nullptr); >+ else { >+ setResourceError(WTFMove(error)); >+ this->error(LoadError); >+ } > }); > return; > } >diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.cpp b/Source/WebCore/loader/cache/CachedResourceLoader.cpp >index e3a0f399eb9..0a678ccf85a 100644 >--- a/Source/WebCore/loader/cache/CachedResourceLoader.cpp >+++ b/Source/WebCore/loader/cache/CachedResourceLoader.cpp >@@ -296,9 +296,9 @@ ResourceErrorOr<CachedResourceHandle<CachedRawResource>> CachedResourceLoader::r > return castCachedResourceTo<CachedRawResource>(requestResource(CachedResource::RawResource, WTFMove(request))); > } > >-ResourceErrorOr<CachedResourceHandle<CachedResource>> CachedResourceLoader::requestBeaconResource(CachedResourceRequest&& request) >+ResourceErrorOr<CachedResourceHandle<CachedRawResource>> CachedResourceLoader::requestBeaconResource(CachedResourceRequest&& request) > { >- return requestResource(CachedResource::Beacon, WTFMove(request)); >+ return castCachedResourceTo<CachedRawResource>(requestResource(CachedResource::Beacon, WTFMove(request))); > } > > ResourceErrorOr<CachedResourceHandle<CachedRawResource>> CachedResourceLoader::requestMainResource(CachedResourceRequest&& request) >diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.h b/Source/WebCore/loader/cache/CachedResourceLoader.h >index 4ccc8864797..d3288cabc13 100644 >--- a/Source/WebCore/loader/cache/CachedResourceLoader.h >+++ b/Source/WebCore/loader/cache/CachedResourceLoader.h >@@ -83,7 +83,7 @@ public: > ResourceErrorOr<CachedResourceHandle<CachedFont>> requestFont(CachedResourceRequest&&, bool isSVG); > ResourceErrorOr<CachedResourceHandle<CachedRawResource>> requestMedia(CachedResourceRequest&&); > ResourceErrorOr<CachedResourceHandle<CachedRawResource>> requestIcon(CachedResourceRequest&&); >- ResourceErrorOr<CachedResourceHandle<CachedResource>> requestBeaconResource(CachedResourceRequest&&); >+ ResourceErrorOr<CachedResourceHandle<CachedRawResource>> requestBeaconResource(CachedResourceRequest&&); > ResourceErrorOr<CachedResourceHandle<CachedRawResource>> requestRawResource(CachedResourceRequest&&); > ResourceErrorOr<CachedResourceHandle<CachedRawResource>> requestMainResource(CachedResourceRequest&&); > ResourceErrorOr<CachedResourceHandle<CachedSVGDocument>> requestSVGDocument(CachedResourceRequest&&); >diff --git a/Source/WebCore/platform/network/PingHandle.h b/Source/WebCore/platform/network/PingHandle.h >index fb210a4b075..10a27dce26b 100644 >--- a/Source/WebCore/platform/network/PingHandle.h >+++ b/Source/WebCore/platform/network/PingHandle.h >@@ -43,7 +43,7 @@ public: > No, > }; > >- PingHandle(NetworkingContext* networkingContext, const ResourceRequest& request, bool shouldUseCredentialStorage, UsesAsyncCallbacks useAsyncCallbacks, bool shouldFollowRedirects, WTF::Function<void()>&& completionHandler) >+ PingHandle(NetworkingContext* networkingContext, const ResourceRequest& request, bool shouldUseCredentialStorage, UsesAsyncCallbacks useAsyncCallbacks, bool shouldFollowRedirects, WTF::Function<void(ResourceError&&)>&& completionHandler) > : m_timeoutTimer(*this, &PingHandle::timeoutTimerFired) > , m_shouldUseCredentialStorage(shouldUseCredentialStorage) > , m_shouldFollowRedirects(shouldFollowRedirects) >@@ -81,7 +81,7 @@ private: > virtual ~PingHandle() > { > if (m_completionHandler) >- m_completionHandler(); >+ m_completionHandler({ }); > > if (m_handle) { > ASSERT(m_handle->client() == this); >@@ -95,7 +95,7 @@ private: > bool m_shouldUseCredentialStorage; > bool m_shouldFollowRedirects; > UsesAsyncCallbacks m_usesAsyncCallbacks; >- WTF::Function<void()> m_completionHandler; >+ WTF::Function<void(ResourceError&&)> m_completionHandler; > }; > > } // namespace WebCore >diff --git a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp >index acdcc438f69..8b6a40db28c 100644 >--- a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp >@@ -245,18 +245,18 @@ void NetworkConnectionToWebProcess::loadPing(NetworkResourceLoadParameters&& loa > RefPtr<NetworkingContext> context = RemoteNetworkingContext::create(loadParameters.sessionID, loadParameters.shouldClearReferrerOnHTTPSToHTTPRedirect); > > // PingHandle manages its own lifetime, deleting itself when its purpose has been fulfilled. >- new PingHandle(context.get(), loadParameters.request, loadParameters.allowStoredCredentials == AllowStoredCredentials, PingHandle::UsesAsyncCallbacks::Yes, loadParameters.shouldFollowRedirects, [this, protectedThis = makeRef(*this), identifier = loadParameters.identifier] { >- didFinishPingLoad(identifier); >+ new PingHandle(context.get(), loadParameters.request, loadParameters.allowStoredCredentials == AllowStoredCredentials, PingHandle::UsesAsyncCallbacks::Yes, loadParameters.shouldFollowRedirects, [this, protectedThis = makeRef(*this), identifier = loadParameters.identifier] (ResourceError&& error) { >+ didFinishPingLoad(identifier, error); > }); > #endif > } > >-void NetworkConnectionToWebProcess::didFinishPingLoad(uint64_t pingLoadIdentifier) >+void NetworkConnectionToWebProcess::didFinishPingLoad(uint64_t pingLoadIdentifier, const ResourceError& error) > { > if (!m_connection->isValid()) > return; > >- m_connection->send(Messages::NetworkProcessConnection::DidFinishPingLoad(pingLoadIdentifier), 0); >+ m_connection->send(Messages::NetworkProcessConnection::DidFinishPingLoad(pingLoadIdentifier, error), 0); > } > > void NetworkConnectionToWebProcess::removeLoadIdentifier(ResourceLoadIdentifier identifier) >diff --git a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h >index 524cd8d895e..2dd1f81d531 100644 >--- a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h >+++ b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h >@@ -38,6 +38,7 @@ > namespace WebCore { > class BlobDataFileReference; > class HTTPHeaderMap; >+class ResourceError; > class ResourceRequest; > } > >@@ -61,7 +62,7 @@ public: > IPC::Connection& connection() { return m_connection.get(); } > > void didCleanupResourceLoader(NetworkResourceLoader&); >- void didFinishPingLoad(uint64_t pingLoadIdentifier); >+ void didFinishPingLoad(uint64_t pingLoadIdentifier, const WebCore::ResourceError&); > > bool captureExtraNetworkLoadMetricsEnabled() const { return m_captureExtraNetworkLoadMetricsEnabled; } > >diff --git a/Source/WebKit/NetworkProcess/PingLoad.cpp b/Source/WebKit/NetworkProcess/PingLoad.cpp >index 829b2797fc5..212c7a651cd 100644 >--- a/Source/WebKit/NetworkProcess/PingLoad.cpp >+++ b/Source/WebKit/NetworkProcess/PingLoad.cpp >@@ -33,6 +33,7 @@ > #include "NetworkCORSPreflightChecker.h" > #include "NetworkConnectionToWebProcess.h" > #include "SessionTracker.h" >+#include "WebErrors.h" > #include <WebCore/ContentSecurityPolicy.h> > #include <WebCore/CrossOriginAccessControl.h> > #include <WebCore/CrossOriginPreflightResultCache.h> >@@ -66,8 +67,6 @@ PingLoad::PingLoad(NetworkResourceLoadParameters&& parameters, HTTPHeaderMap&& o > > PingLoad::~PingLoad() > { >- m_connection->didFinishPingLoad(m_parameters.identifier); >- > if (m_redirectHandler) > m_redirectHandler({ }); > >@@ -78,6 +77,12 @@ PingLoad::~PingLoad() > } > } > >+void PingLoad::didFinish(const ResourceError& error) >+{ >+ m_connection->didFinishPingLoad(m_parameters.identifier, error); >+ delete this; >+} >+ > void PingLoad::loadRequest(ResourceRequest&& request) > { > RELEASE_LOG_IF_ALLOWED("startNetworkLoad"); >@@ -97,6 +102,8 @@ SecurityOrigin& PingLoad::securityOrigin() const > > void PingLoad::willPerformHTTPRedirection(ResourceResponse&& redirectResponse, ResourceRequest&& request, RedirectCompletionHandler&& completionHandler) > { >+ m_lastRedirectionRequest = request; >+ > RELEASE_LOG_IF_ALLOWED("willPerformHTTPRedirection - shouldFollowRedirects? %d", m_parameters.shouldFollowRedirects); > if (!m_parameters.shouldFollowRedirects) { > completionHandler({ }); >@@ -149,14 +156,14 @@ void PingLoad::didReceiveChallenge(const AuthenticationChallenge&, ChallengeComp > { > RELEASE_LOG_IF_ALLOWED("didReceiveChallenge"); > completionHandler(AuthenticationChallengeDisposition::Cancel, { }); >- delete this; >+ didFinish(ResourceError { String(), 0, currentRequest().url(), ASCIILiteral("Failed HTTP authentication"), ResourceError::Type::AccessControl }); > } > > void PingLoad::didReceiveResponseNetworkSession(ResourceResponse&& response, ResponseCompletionHandler&& completionHandler) > { > RELEASE_LOG_IF_ALLOWED("didReceiveResponseNetworkSession - httpStatusCode: %d", response.httpStatusCode()); > completionHandler(PolicyAction::PolicyIgnore); >- delete this; >+ didFinish(); > } > > void PingLoad::didReceiveData(Ref<SharedBuffer>&&) >@@ -171,7 +178,8 @@ void PingLoad::didCompleteWithError(const ResourceError& error, const NetworkLoa > RELEASE_LOG_IF_ALLOWED("didComplete"); > else > RELEASE_LOG_IF_ALLOWED("didCompleteWithError, error_code: %d", error.errorCode()); >- delete this; >+ >+ didFinish(error); > } > > void PingLoad::didSendData(uint64_t totalBytesSent, uint64_t totalBytesExpectedToSend) >@@ -181,19 +189,27 @@ void PingLoad::didSendData(uint64_t totalBytesSent, uint64_t totalBytesExpectedT > void PingLoad::wasBlocked() > { > RELEASE_LOG_IF_ALLOWED("wasBlocked"); >- delete this; >+ didFinish(blockedError(currentRequest())); > } > > void PingLoad::cannotShowURL() > { > RELEASE_LOG_IF_ALLOWED("cannotShowURL"); >- delete this; >+ didFinish(cannotShowURLError(currentRequest())); > } > > void PingLoad::timeoutTimerFired() > { > RELEASE_LOG_IF_ALLOWED("timeoutTimerFired"); >- delete this; >+ didFinish(ResourceError { String(), 0, currentRequest().url(), ASCIILiteral("Load timed out"), ResourceError::Type::Timeout }); >+} >+ >+const ResourceRequest& PingLoad::currentRequest() const >+{ >+ if (m_lastRedirectionRequest) >+ return *m_lastRedirectionRequest; >+ >+ return m_parameters.request; > } > > bool PingLoad::isAllowedRedirect(const URL& url) const >@@ -262,7 +278,7 @@ void PingLoad::makeCrossOriginAccessRequestWithPreflight(ResourceRequest&& reque > if (result == NetworkCORSPreflightChecker::Result::Success) > preflightSuccess(ResourceRequest { corsPreflightChecker->originalRequest() }); > else >- delete this; >+ didFinish(ResourceError { String(), 0, corsPreflightChecker->originalRequest().url(), ASCIILiteral("CORS preflight failed"), ResourceError::Type::AccessControl }); > }); > m_corsPreflightChecker->startPreflight(); > } >diff --git a/Source/WebKit/NetworkProcess/PingLoad.h b/Source/WebKit/NetworkProcess/PingLoad.h >index 457ef6ce4fc..cf6aa10ab8a 100644 >--- a/Source/WebKit/NetworkProcess/PingLoad.h >+++ b/Source/WebKit/NetworkProcess/PingLoad.h >@@ -29,6 +29,7 @@ > > #include "NetworkDataTask.h" > #include "NetworkResourceLoadParameters.h" >+#include <WebCore/ResourceError.h> > > namespace WebCore { > class ContentSecurityPolicy; >@@ -68,6 +69,9 @@ private: > void preflightSuccess(WebCore::ResourceRequest&&); > > WebCore::SecurityOrigin& securityOrigin() const; >+ >+ const WebCore::ResourceRequest& currentRequest() const; >+ void didFinish(const WebCore::ResourceError& = { }); > > NetworkResourceLoadParameters m_parameters; > WebCore::HTTPHeaderMap m_originalRequestHeaders; // Needed for CORS checks. >@@ -80,6 +84,7 @@ private: > bool m_isSimpleRequest { true }; > RedirectCompletionHandler m_redirectHandler; > mutable std::unique_ptr<WebCore::ContentSecurityPolicy> m_contentSecurityPolicy; >+ std::optional<WebCore::ResourceRequest> m_lastRedirectionRequest; > }; > > } >diff --git a/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp b/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp >index 42a2db20e55..9624e2964c7 100644 >--- a/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp >+++ b/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp >@@ -135,9 +135,9 @@ void NetworkProcessConnection::didWriteBlobsToTemporaryFiles(uint64_t requestIde > handler(filenames); > } > >-void NetworkProcessConnection::didFinishPingLoad(uint64_t pingLoadIdentifier) >+void NetworkProcessConnection::didFinishPingLoad(uint64_t pingLoadIdentifier, ResourceError&& error) > { >- WebProcess::singleton().webLoaderStrategy().didFinishPingLoad(pingLoadIdentifier); >+ WebProcess::singleton().webLoaderStrategy().didFinishPingLoad(pingLoadIdentifier, WTFMove(error)); > } > > #if ENABLE(SHAREABLE_RESOURCE) >diff --git a/Source/WebKit/WebProcess/Network/NetworkProcessConnection.h b/Source/WebKit/WebProcess/Network/NetworkProcessConnection.h >index 09cd05b9ce9..c5344ea65d0 100644 >--- a/Source/WebKit/WebProcess/Network/NetworkProcessConnection.h >+++ b/Source/WebKit/WebProcess/Network/NetworkProcessConnection.h >@@ -73,7 +73,7 @@ private: > void didReceiveInvalidMessage(IPC::Connection&, IPC::StringReference messageReceiverName, IPC::StringReference messageName) override; > > void didWriteBlobsToTemporaryFiles(uint64_t requestIdentifier, const Vector<String>& filenames); >- void didFinishPingLoad(uint64_t pingLoadIdentifier); >+ void didFinishPingLoad(uint64_t pingLoadIdentifier, WebCore::ResourceError&&); > > #if ENABLE(SHAREABLE_RESOURCE) > // Message handlers. >diff --git a/Source/WebKit/WebProcess/Network/NetworkProcessConnection.messages.in b/Source/WebKit/WebProcess/Network/NetworkProcessConnection.messages.in >index b674f7eb491..83ef2e62289 100644 >--- a/Source/WebKit/WebProcess/Network/NetworkProcessConnection.messages.in >+++ b/Source/WebKit/WebProcess/Network/NetworkProcessConnection.messages.in >@@ -27,5 +27,5 @@ messages -> NetworkProcessConnection LegacyReceiver { > #endif > > DidWriteBlobsToTemporaryFiles(uint64_t requestIdentifier, Vector<String> filenames) >- DidFinishPingLoad(uint64_t pingLoadIdentifier) >+ DidFinishPingLoad(uint64_t pingLoadIdentifier, WebCore::ResourceError error) > } >diff --git a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp >index 69fb91c82b8..e97fcbd7f92 100644 >--- a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp >+++ b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp >@@ -353,7 +353,7 @@ void WebLoaderStrategy::networkProcessCrashed() > > auto pingLoadCompletionHandlers = WTFMove(m_pingLoadCompletionHandlers); > for (auto& pingLoadCompletionHandler : pingLoadCompletionHandlers.values()) >- pingLoadCompletionHandler(); >+ pingLoadCompletionHandler(internalError(URL())); > } > > void WebLoaderStrategy::loadResourceSynchronously(NetworkingContext* context, unsigned long resourceLoadIdentifier, const ResourceRequest& request, StoredCredentials storedCredentials, ClientCredentialPolicy clientCredentialPolicy, ResourceError& error, ResourceResponse& response, Vector<char>& data) >@@ -396,13 +396,13 @@ static uint64_t generatePingLoadIdentifier() > return ++identifier; > } > >-void WebLoaderStrategy::startPingLoad(NetworkingContext* networkingContext, ResourceRequest& request, const HTTPHeaderMap& originalRequestHeaders, Ref<SecurityOrigin>&& sourceOrigin, ContentSecurityPolicy* contentSecurityPolicy, const FetchOptions& options, WTF::Function<void()>&& completionHandler) >+void WebLoaderStrategy::startPingLoad(NetworkingContext* networkingContext, ResourceRequest& request, const HTTPHeaderMap& originalRequestHeaders, Ref<SecurityOrigin>&& sourceOrigin, ContentSecurityPolicy* contentSecurityPolicy, const FetchOptions& options, PingLoadCompletionHandler&& completionHandler) > { > // 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. > if (!networkingContext) { > if (completionHandler) >- completionHandler(); >+ completionHandler(internalError(request.url())); > return; > } > >@@ -429,10 +429,10 @@ void WebLoaderStrategy::startPingLoad(NetworkingContext* networkingContext, Reso > WebProcess::singleton().networkConnection().connection().send(Messages::NetworkConnectionToWebProcess::LoadPing(WTFMove(loadParameters), originalRequestHeaders), 0); > } > >-void WebLoaderStrategy::didFinishPingLoad(uint64_t pingLoadIdentifier) >+void WebLoaderStrategy::didFinishPingLoad(uint64_t pingLoadIdentifier, ResourceError&& error) > { > if (auto completionHandler = m_pingLoadCompletionHandlers.take(pingLoadIdentifier)) >- completionHandler(); >+ completionHandler(WTFMove(error)); > } > > void WebLoaderStrategy::storeDerivedDataToCache(const SHA1::Digest& bodyHash, const String& type, const String& partition, WebCore::SharedBuffer& data) >diff --git a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h >index 27fea04f3b4..2f44f8db80a 100644 >--- a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h >+++ b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h >@@ -59,8 +59,8 @@ public: > void suspendPendingRequests() final; > void resumePendingRequests() final; > >- void startPingLoad(WebCore::NetworkingContext*, WebCore::ResourceRequest&, const WebCore::HTTPHeaderMap& originalRequestHeaders, Ref<WebCore::SecurityOrigin>&& sourceOrigin, WebCore::ContentSecurityPolicy*, const WebCore::FetchOptions&, WTF::Function<void()>&& completionHandler) final; >- void didFinishPingLoad(uint64_t pingLoadIdentifier); >+ void startPingLoad(WebCore::NetworkingContext*, WebCore::ResourceRequest&, const WebCore::HTTPHeaderMap& originalRequestHeaders, Ref<WebCore::SecurityOrigin>&& sourceOrigin, WebCore::ContentSecurityPolicy*, const WebCore::FetchOptions&, PingLoadCompletionHandler&&) final; >+ void didFinishPingLoad(uint64_t pingLoadIdentifier, WebCore::ResourceError&&); > > void storeDerivedDataToCache(const SHA1::Digest& bodyHash, const String& type, const String& partition, WebCore::SharedBuffer&) final; > >@@ -85,7 +85,7 @@ private: > > HashMap<unsigned long, RefPtr<WebResourceLoader>> m_webResourceLoaders; > HashMap<unsigned long, WebURLSchemeTaskProxy*> m_urlSchemeTasks; >- HashMap<unsigned long, WTF::Function<void()>> m_pingLoadCompletionHandlers; >+ HashMap<unsigned long, PingLoadCompletionHandler> m_pingLoadCompletionHandlers; > }; > > } // namespace WebKit >diff --git a/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.cpp b/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.cpp >index 3a752f58c46..dbe9d3d677c 100644 >--- a/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.cpp >+++ b/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.cpp >@@ -363,7 +363,7 @@ bool WebResourceLoadScheduler::HostInformation::limitRequests(ResourceLoadPriori > return m_requestsLoading.size() >= (webResourceLoadScheduler().isSerialLoadingEnabled() ? 1 : m_maxRequestsInFlight); > } > >-void WebResourceLoadScheduler::startPingLoad(NetworkingContext* networkingContext, ResourceRequest& request, const HTTPHeaderMap&, Ref<SecurityOrigin>&&, WebCore::ContentSecurityPolicy*, const FetchOptions& options, WTF::Function<void()>&& completionHandler) >+void WebResourceLoadScheduler::startPingLoad(NetworkingContext* networkingContext, ResourceRequest& request, const HTTPHeaderMap&, Ref<SecurityOrigin>&&, WebCore::ContentSecurityPolicy*, const FetchOptions& options, PingLoadCompletionHandler&& completionHandler) > { > // PingHandle manages its own lifetime, deleting itself when its purpose has been fulfilled. > new PingHandle(networkingContext, request, options.credentials != FetchOptions::Credentials::Omit, PingHandle::UsesAsyncCallbacks::No, options.redirect == FetchOptions::Redirect::Follow, WTFMove(completionHandler)); >diff --git a/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.h b/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.h >index 3701bc33b70..f816627ea44 100644 >--- a/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.h >+++ b/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.h >@@ -59,7 +59,7 @@ public: > void suspendPendingRequests() final; > void resumePendingRequests() final; > >- void startPingLoad(WebCore::NetworkingContext*, WebCore::ResourceRequest&, const WebCore::HTTPHeaderMap&, Ref<WebCore::SecurityOrigin>&& sourceOrigin, WebCore::ContentSecurityPolicy*, const WebCore::FetchOptions&, WTF::Function<void()>&& completionHandler) final; >+ void startPingLoad(WebCore::NetworkingContext*, WebCore::ResourceRequest&, const WebCore::HTTPHeaderMap&, Ref<WebCore::SecurityOrigin>&& sourceOrigin, WebCore::ContentSecurityPolicy*, const WebCore::FetchOptions&, PingLoadCompletionHandler&&) final; > > void storeDerivedDataToCache(const SHA1::Digest&, const String&, const String&, WebCore::SharedBuffer&) final { } >
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 175723
:
318535
|
318538
|
318541
|
318549
|
318556