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
175443_Beacon_quota2_wip.patch (text/plain), 18.50 KB, created by
Chris Dumez
on 2017-08-16 16:04:06 PDT
(
hide
)
Description:
WIP Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2017-08-16 16:04:06 PDT
Size:
18.50 KB
patch
obsolete
>diff --git a/LayoutTests/http/wpt/beacon/beacon-quota-expected.txt b/LayoutTests/http/wpt/beacon/beacon-quota-expected.txt >index b78c982473b..bf279a1f63d 100644 >--- a/LayoutTests/http/wpt/beacon/beacon-quota-expected.txt >+++ b/LayoutTests/http/wpt/beacon/beacon-quota-expected.txt >@@ -1,5 +1,6 @@ > CONSOLE MESSAGE: line 14: Reached maximum amount of queued data of 64Kb for keepalive requests >+CONSOLE MESSAGE: line 19: Reached maximum amount of queued data of 64Kb for keepalive requests > > PASS Beacon with a body above the Quota Limit should fail. >-FAIL Multiple Beacons Quota Limit assert_false: Second beacon should not be sent because we reached the quota expected false got true >+PASS Multiple Beacons Quota Limit > >diff --git a/Source/WebCore/loader/LoaderStrategy.h b/Source/WebCore/loader/LoaderStrategy.h >index c4db7a1bf03..7ab6b322740 100644 >--- a/Source/WebCore/loader/LoaderStrategy.h >+++ b/Source/WebCore/loader/LoaderStrategy.h >@@ -63,7 +63,7 @@ public: > virtual void suspendPendingRequests() = 0; > virtual void resumePendingRequests() = 0; > >- virtual void createPingHandle(NetworkingContext*, ResourceRequest&, Ref<SecurityOrigin>&& sourceOrigin, ContentSecurityPolicy*, const FetchOptions&) = 0; >+ virtual void startPingLoad(NetworkingContext*, ResourceRequest&, Ref<SecurityOrigin>&& sourceOrigin, ContentSecurityPolicy*, const FetchOptions&, WTF::Function<void()>&& completionHandler = { }) = 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 8e5169b50ef..8afcc92878e 100644 >--- a/Source/WebCore/loader/PingLoader.cpp >+++ b/Source/WebCore/loader/PingLoader.cpp >@@ -195,7 +195,7 @@ void PingLoader::startPingLoad(Frame& frame, ResourceRequest& request, Document& > InspectorInstrumentation::continueAfterPingLoader(frame, identifier, frame.loader().activeDocumentLoader(), request, ResourceResponse()); > > auto* contentSecurityPolicy = document.shouldBypassMainWorldContentSecurityPolicy() ? nullptr : document.contentSecurityPolicy(); >- platformStrategies()->loaderStrategy()->createPingHandle(frame.loader().networkingContext(), request, document.securityOrigin(), contentSecurityPolicy, options); >+ platformStrategies()->loaderStrategy()->startPingLoad(frame.loader().networkingContext(), request, document.securityOrigin(), contentSecurityPolicy, options); > } > > } >diff --git a/Source/WebCore/loader/cache/CachedResource.cpp b/Source/WebCore/loader/cache/CachedResource.cpp >index e5eec25feee..53b9a5ed20f 100644 >--- a/Source/WebCore/loader/cache/CachedResource.cpp >+++ b/Source/WebCore/loader/cache/CachedResource.cpp >@@ -272,9 +272,10 @@ void CachedResource::load(CachedResourceLoader& cachedResourceLoader) > // Beacon is not exposed to workers so it is safe to rely on the document here. > auto* document = cachedResourceLoader.document(); > auto* contentSecurityPolicy = document && !document->shouldBypassMainWorldContentSecurityPolicy() ? document->contentSecurityPolicy() : nullptr; >- platformStrategies()->loaderStrategy()->createPingHandle(frame.loader().networkingContext(), request, *m_origin, contentSecurityPolicy, m_options); >- // FIXME: We currently do not get notified when ping loads finish so we treat them as finishing right away. >- finishLoading(nullptr); >+ CachedResourceHandle<CachedResource> protectedThis(this); >+ platformStrategies()->loaderStrategy()->startPingLoad(frame.loader().networkingContext(), request, *m_origin, contentSecurityPolicy, m_options, [this, protectedThis = WTFMove(protectedThis)] { >+ finishLoading(nullptr); >+ }); > return; > } > } >diff --git a/Source/WebCore/platform/network/PingHandle.h b/Source/WebCore/platform/network/PingHandle.h >index cbafc093569..fb210a4b075 100644 >--- a/Source/WebCore/platform/network/PingHandle.h >+++ b/Source/WebCore/platform/network/PingHandle.h >@@ -43,11 +43,12 @@ public: > No, > }; > >- PingHandle(NetworkingContext* networkingContext, const ResourceRequest& request, bool shouldUseCredentialStorage, UsesAsyncCallbacks useAsyncCallbacks, bool shouldFollowRedirects) >+ PingHandle(NetworkingContext* networkingContext, const ResourceRequest& request, bool shouldUseCredentialStorage, UsesAsyncCallbacks useAsyncCallbacks, bool shouldFollowRedirects, WTF::Function<void()>&& completionHandler) > : m_timeoutTimer(*this, &PingHandle::timeoutTimerFired) > , m_shouldUseCredentialStorage(shouldUseCredentialStorage) > , m_shouldFollowRedirects(shouldFollowRedirects) > , m_usesAsyncCallbacks(useAsyncCallbacks) >+ , m_completionHandler(WTFMove(completionHandler)) > { > m_handle = ResourceHandle::create(networkingContext, request, this, false, false); > >@@ -79,6 +80,9 @@ private: > > virtual ~PingHandle() > { >+ if (m_completionHandler) >+ m_completionHandler(); >+ > if (m_handle) { > ASSERT(m_handle->client() == this); > m_handle->clearClient(); >@@ -91,6 +95,7 @@ private: > bool m_shouldUseCredentialStorage; > bool m_shouldFollowRedirects; > UsesAsyncCallbacks m_usesAsyncCallbacks; >+ WTF::Function<void()> m_completionHandler; > }; > > } // namespace WebCore >diff --git a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp >index 73ba60c27e3..9eb9f1bafab 100644 >--- a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp >@@ -226,15 +226,25 @@ void NetworkConnectionToWebProcess::loadPing(NetworkResourceLoadParameters&& loa > { > #if USE(NETWORK_SESSION) > // PingLoad manages its own lifetime, deleting itself when its purpose has been fulfilled. >- new PingLoad(WTFMove(loadParameters)); >+ new PingLoad(WTFMove(loadParameters), *this); > #else > 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); >+ new PingHandle(context.get(), loadParameters.request, loadParameters.allowStoredCredentials == AllowStoredCredentials, PingHandle::UsesAsyncCallbacks::Yes, loadParameters.shouldFollowRedirects, [this, protectedThis = makeRef(*this), identifier = loadParameters.identifier] { >+ didFinishPingLoad(identifier); >+ }); > #endif > } > >+void NetworkConnectionToWebProcess::didFinishPingLoad(uint64_t pingLoadIdentifier) >+{ >+ if (!m_connection->isValid()) >+ return; >+ >+ m_connection->send(Messages::NetworkProcessConnection::DidFinishPingLoad(pingLoadIdentifier), 0); >+} >+ > void NetworkConnectionToWebProcess::removeLoadIdentifier(ResourceLoadIdentifier identifier) > { > RefPtr<NetworkResourceLoader> loader = m_networkResourceLoaders.get(identifier); >diff --git a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h >index 384cce74c42..020a8355a1c 100644 >--- a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h >+++ b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h >@@ -59,6 +59,7 @@ public: > IPC::Connection& connection() { return m_connection.get(); } > > void didCleanupResourceLoader(NetworkResourceLoader&); >+ void didFinishPingLoad(uint64_t pingLoadIdentifier); > > bool captureExtraNetworkLoadMetricsEnabled() const { return m_captureExtraNetworkLoadMetricsEnabled; } > >diff --git a/Source/WebKit/NetworkProcess/PingLoad.cpp b/Source/WebKit/NetworkProcess/PingLoad.cpp >index 588568e89b3..6b65e379356 100644 >--- a/Source/WebKit/NetworkProcess/PingLoad.cpp >+++ b/Source/WebKit/NetworkProcess/PingLoad.cpp >@@ -31,6 +31,7 @@ > #include "AuthenticationManager.h" > #include "Logging.h" > #include "NetworkCORSPreflightChecker.h" >+#include "NetworkConnectionToWebProcess.h" > #include "SessionTracker.h" > #include <WebCore/ContentSecurityPolicy.h> > #include <WebCore/CrossOriginAccessControl.h> >@@ -41,8 +42,9 @@ namespace WebKit { > > using namespace WebCore; > >-PingLoad::PingLoad(NetworkResourceLoadParameters&& parameters) >+PingLoad::PingLoad(NetworkResourceLoadParameters&& parameters, Ref<NetworkConnectionToWebProcess>&& connection) > : m_parameters(WTFMove(parameters)) >+ , m_connection(WTFMove(connection)) > , m_timeoutTimer(*this, &PingLoad::timeoutTimerFired) > , m_isSameOriginRequest(securityOrigin().canRequest(m_parameters.request.url())) > { >@@ -58,6 +60,8 @@ PingLoad::PingLoad(NetworkResourceLoadParameters&& parameters) > > PingLoad::~PingLoad() > { >+ m_connection->didFinishPingLoad(m_parameters.identifier); >+ > if (m_redirectHandler) > m_redirectHandler({ }); > >diff --git a/Source/WebKit/NetworkProcess/PingLoad.h b/Source/WebKit/NetworkProcess/PingLoad.h >index 3600a4b4497..f2e4199a3da 100644 >--- a/Source/WebKit/NetworkProcess/PingLoad.h >+++ b/Source/WebKit/NetworkProcess/PingLoad.h >@@ -37,10 +37,11 @@ class ContentSecurityPolicy; > namespace WebKit { > > class NetworkCORSPreflightChecker; >+class NetworkConnectionToWebProcess; > > class PingLoad final : private NetworkDataTaskClient { > public: >- explicit PingLoad(NetworkResourceLoadParameters&&); >+ PingLoad(NetworkResourceLoadParameters&&, Ref<NetworkConnectionToWebProcess>&&); > > private: > ~PingLoad(); >@@ -64,6 +65,7 @@ private: > WebCore::SecurityOrigin& securityOrigin() const; > > NetworkResourceLoadParameters m_parameters; >+ Ref<NetworkConnectionToWebProcess> m_connection; > RefPtr<NetworkDataTask> m_task; > WebCore::Timer m_timeoutTimer; > std::unique_ptr<NetworkCORSPreflightChecker> m_corsPreflightChecker; >diff --git a/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp b/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp >index a2393027ad1..96331530a7b 100644 >--- a/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp >+++ b/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp >@@ -128,6 +128,11 @@ void NetworkProcessConnection::didWriteBlobsToTemporaryFiles(uint64_t requestIde > handler(filenames); > } > >+void NetworkProcessConnection::didFinishPingLoad(uint64_t pingLoadIdentifier) >+{ >+ WebProcess::singleton().webLoaderStrategy().didFinishPingLoad(pingLoadIdentifier); >+} >+ > #if ENABLE(SHAREABLE_RESOURCE) > void NetworkProcessConnection::didCacheResource(const ResourceRequest& request, const ShareableResource::Handle& handle, SessionID sessionID) > { >diff --git a/Source/WebKit/WebProcess/Network/NetworkProcessConnection.h b/Source/WebKit/WebProcess/Network/NetworkProcessConnection.h >index fb30156e845..d4e2b757b5c 100644 >--- a/Source/WebKit/WebProcess/Network/NetworkProcessConnection.h >+++ b/Source/WebKit/WebProcess/Network/NetworkProcessConnection.h >@@ -70,6 +70,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); > > #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 a4fc426d804..507facde9b6 100644 >--- a/Source/WebKit/WebProcess/Network/NetworkProcessConnection.messages.in >+++ b/Source/WebKit/WebProcess/Network/NetworkProcessConnection.messages.in >@@ -27,4 +27,5 @@ messages -> NetworkProcessConnection LegacyReceiver { > #endif > > DidWriteBlobsToTemporaryFiles(uint64_t requestIdentifier, Vector<String> filenames) >+ DidFinishPingLoad(uint64_t pingLoadIdentifier) > } >diff --git a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp >index 9d9775b048f..c25cf263a3d 100644 >--- a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp >+++ b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp >@@ -386,12 +386,20 @@ void WebLoaderStrategy::loadResourceSynchronously(NetworkingContext* context, un > } > } > >-void WebLoaderStrategy::createPingHandle(NetworkingContext* networkingContext, ResourceRequest& request, Ref<SecurityOrigin>&& sourceOrigin, ContentSecurityPolicy* contentSecurityPolicy, const FetchOptions& options) >+static uint64_t generatePingLoadIdentifier() >+{ >+ static uint64_t identifier = 0; >+ return ++identifier; >+} >+ >+void WebLoaderStrategy::startPingLoad(NetworkingContext* networkingContext, ResourceRequest& request, Ref<SecurityOrigin>&& sourceOrigin, ContentSecurityPolicy* contentSecurityPolicy, const FetchOptions& options, WTF::Function<void()>&& 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 (!networkingContext) { >+ completionHandler(); > return; >+ } > > WebFrameNetworkingContext* webContext = static_cast<WebFrameNetworkingContext*>(networkingContext); > WebFrameLoaderClient* webFrameLoaderClient = webContext->webFrameLoaderClient(); >@@ -399,6 +407,7 @@ void WebLoaderStrategy::createPingHandle(NetworkingContext* networkingContext, R > WebPage* webPage = webFrame ? webFrame->page() : nullptr; > > NetworkResourceLoadParameters loadParameters; >+ loadParameters.identifier = generatePingLoadIdentifier(); > loadParameters.request = request; > loadParameters.sourceOrigin = WTFMove(sourceOrigin); > loadParameters.sessionID = webPage ? webPage->sessionID() : SessionID::defaultSessionID(); >@@ -409,9 +418,18 @@ void WebLoaderStrategy::createPingHandle(NetworkingContext* networkingContext, R > if (contentSecurityPolicy) > loadParameters.cspResponseHeaders = contentSecurityPolicy->responseHeaders(); > >+ if (completionHandler) >+ m_pingLoadCompletionHandlers.add(loadParameters.identifier, WTFMove(completionHandler)); >+ > WebProcess::singleton().networkConnection().connection().send(Messages::NetworkConnectionToWebProcess::LoadPing(loadParameters), 0); > } > >+void WebLoaderStrategy::didFinishPingLoad(uint64_t pingLoadIdentifier) >+{ >+ if (auto completionHandler = m_pingLoadCompletionHandlers.take(pingLoadIdentifier)) >+ completionHandler(); >+} >+ > void WebLoaderStrategy::storeDerivedDataToCache(const SHA1::Digest& bodyHash, const String& type, const String& partition, WebCore::SharedBuffer& data) > { > NetworkCache::DataKey key { partition, type, bodyHash }; >diff --git a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h >index 4d3511467cc..062d5e5495b 100644 >--- a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h >+++ b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h >@@ -59,7 +59,8 @@ public: > void suspendPendingRequests() final; > void resumePendingRequests() final; > >- void createPingHandle(WebCore::NetworkingContext*, WebCore::ResourceRequest&, Ref<WebCore::SecurityOrigin>&& sourceOrigin, WebCore::ContentSecurityPolicy*, const WebCore::FetchOptions&) final; >+ void startPingLoad(WebCore::NetworkingContext*, WebCore::ResourceRequest&, Ref<WebCore::SecurityOrigin>&& sourceOrigin, WebCore::ContentSecurityPolicy*, const WebCore::FetchOptions&, WTF::Function<void()>&& completionHandler) final; >+ void didFinishPingLoad(uint64_t pingLoadIdentifier); > > void storeDerivedDataToCache(const SHA1::Digest& bodyHash, const String& type, const String& partition, WebCore::SharedBuffer&) final; > >@@ -84,6 +85,7 @@ private: > > HashMap<unsigned long, RefPtr<WebResourceLoader>> m_webResourceLoaders; > HashMap<unsigned long, WebURLSchemeTaskProxy*> m_urlSchemeTasks; >+ HashMap<unsigned long, WTF::Function<void()>> m_pingLoadCompletionHandlers; > }; > > } // namespace WebKit >diff --git a/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.cpp b/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.cpp >index 71d01e12786..ea0c4f9d3f2 100644 >--- a/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.cpp >+++ b/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.cpp >@@ -363,9 +363,9 @@ bool WebResourceLoadScheduler::HostInformation::limitRequests(ResourceLoadPriori > return m_requestsLoading.size() >= (webResourceLoadScheduler().isSerialLoadingEnabled() ? 1 : m_maxRequestsInFlight); > } > >-void WebResourceLoadScheduler::createPingHandle(NetworkingContext* networkingContext, ResourceRequest& request, Ref<SecurityOrigin>&&, WebCore::ContentSecurityPolicy*, const FetchOptions& options) >+void WebResourceLoadScheduler::startPingLoad(NetworkingContext* networkingContext, ResourceRequest& request, Ref<SecurityOrigin>&&, WebCore::ContentSecurityPolicy*, const FetchOptions& options, WTF::Function<void()>&& 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); >+ 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 34cb6767a91..8d81cf8edee 100644 >--- a/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.h >+++ b/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.h >@@ -59,7 +59,7 @@ public: > void suspendPendingRequests() override; > void resumePendingRequests() override; > >- void createPingHandle(WebCore::NetworkingContext*, WebCore::ResourceRequest&, Ref<WebCore::SecurityOrigin>&& sourceOrigin, WebCore::ContentSecurityPolicy*, const WebCore::FetchOptions&) override; >+ void startPingLoad(WebCore::NetworkingContext*, WebCore::ResourceRequest&, Ref<WebCore::SecurityOrigin>&& sourceOrigin, WebCore::ContentSecurityPolicy*, const WebCore::FetchOptions&, WTF::Function<void()>&& completionHandler) 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
Flags:
buildbot
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 175443
:
318298
|
318299
|
318309
|
318311
|
318399
|
318442
|
318451
|
318457
|
318516