Diff
Modified: trunk/Source/WebCore/ChangeLog (224888 => 224889)
--- trunk/Source/WebCore/ChangeLog 2017-11-15 19:22:44 UTC (rev 224888)
+++ trunk/Source/WebCore/ChangeLog 2017-11-15 19:28:03 UTC (rev 224889)
@@ -1,3 +1,16 @@
+2017-11-15 Youenn Fablet <you...@apple.com>
+
+ Add ServiceWorker to WebProcess plumbery for FormData fetch responses
+ https://bugs.webkit.org/show_bug.cgi?id=179694
+
+ Reviewed by Alex Christensen.
+
+ No observable changes since we are not actually loading FormData right now.
+
+ * workers/service/context/ServiceWorkerFetch.cpp:
+ (WebCore::ServiceWorkerFetch::processResponse):
+ * workers/service/context/ServiceWorkerFetch.h:
+
2017-11-15 Jer Noble <jer.no...@apple.com>
Add a compile-time-checked string literal initializer for FourCC.
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerFetch.cpp (224888 => 224889)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerFetch.cpp 2017-11-15 19:22:44 UTC (rev 224888)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerFetch.cpp 2017-11-15 19:28:03 UTC (rev 224889)
@@ -75,8 +75,8 @@
}
auto body = response->consumeBody();
- WTF::switchOn(body, [] (Ref<FormData>&) {
- // FIXME: Support FormData response bodies.
+ WTF::switchOn(body, [&] (Ref<FormData>& formData) {
+ client->didReceiveFormData(WTFMove(formData));
}, [&] (Ref<SharedBuffer>& buffer) {
client->didReceiveData(WTFMove(buffer));
}, [] (std::nullptr_t&) {
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerFetch.h (224888 => 224889)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerFetch.h 2017-11-15 19:22:44 UTC (rev 224888)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerFetch.h 2017-11-15 19:28:03 UTC (rev 224889)
@@ -34,6 +34,7 @@
class FetchEvent;
struct FetchOptions;
class FetchResponse;
+class FormData;
class ResourceRequest;
class ResourceResponse;
class SharedBuffer;
@@ -46,6 +47,7 @@
virtual void didReceiveResponse(const ResourceResponse&) = 0;
virtual void didReceiveData(Ref<SharedBuffer>&&) = 0;
+ virtual void didReceiveFormData(Ref<FormData>&&) = 0;
virtual void didFail() = 0;
virtual void didFinish() = 0;
virtual void didNotHandle() = 0;
Modified: trunk/Source/WebKit/ChangeLog (224888 => 224889)
--- trunk/Source/WebKit/ChangeLog 2017-11-15 19:22:44 UTC (rev 224888)
+++ trunk/Source/WebKit/ChangeLog 2017-11-15 19:28:03 UTC (rev 224889)
@@ -1,3 +1,34 @@
+2017-11-15 Youenn Fablet <you...@apple.com>
+
+ Add ServiceWorker to WebProcess plumbery for FormData fetch responses
+ https://bugs.webkit.org/show_bug.cgi?id=179694
+
+ Reviewed by Alex Christensen.
+
+ Added plumbery from Service Worker up to Web Process to pass form data response bodies.
+ A follow-up patch should read the data from Network Process and send it to the ResourceLoader.
+
+ * Platform/IPC/FormDataReference.h: Added.
+ (IPC::FormDataReference::FormDataReference):
+ (IPC::FormDataReference::takeData):
+ (IPC::FormDataReference::encode const):
+ (IPC::FormDataReference::decode):
+ * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
+ (WebKit::WebSWServerConnection::didReceiveFetchFormData):
+ * StorageProcess/ServiceWorker/WebSWServerConnection.h:
+ * StorageProcess/StorageProcess.cpp:
+ (WebKit::StorageProcess::didReceiveFetchFormData):
+ * StorageProcess/StorageProcess.h:
+ * StorageProcess/StorageProcess.messages.in:
+ * WebKit.xcodeproj/project.pbxproj:
+ * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
+ (WebKit::ServiceWorkerClientFetch::didReceiveFormData):
+ * WebProcess/Storage/ServiceWorkerClientFetch.h:
+ * WebProcess/Storage/ServiceWorkerClientFetch.messages.in:
+ * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
+ (WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormData):
+ * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
+
2017-11-15 Alex Christensen <achristen...@webkit.org>
Move a compiled WKContentRuleList to its destination before calling mmap
Copied: trunk/Source/WebKit/Platform/IPC/FormDataReference.h (from rev 224888, trunk/Source/WebCore/workers/service/context/ServiceWorkerFetch.h) (0 => 224889)
--- trunk/Source/WebKit/Platform/IPC/FormDataReference.h (rev 0)
+++ trunk/Source/WebKit/Platform/IPC/FormDataReference.h 2017-11-15 19:28:03 UTC (rev 224889)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 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.
+ */
+
+#pragma once
+
+#include "Decoder.h"
+#include "Encoder.h"
+#include <WebCore/FormData.h>
+#include <wtf/Vector.h>
+
+namespace IPC {
+
+class FormDataReference {
+public:
+ FormDataReference() = default;
+
+ explicit FormDataReference(Ref<WebCore::FormData>&& data)
+ : m_data(WTFMove(data))
+ {
+ }
+
+ Ref<WebCore::FormData> takeData() { return m_data.releaseNonNull(); }
+
+ void encode(Encoder& encoder) const { encoder << *m_data; }
+ static std::optional<FormDataReference> decode(Decoder& decoder)
+ {
+ auto formData = WebCore::FormData::decode(decoder);
+ if (!formData)
+ return std::nullopt;
+ return FormDataReference { formData.releaseNonNull() };
+ }
+
+private:
+ RefPtr<WebCore::FormData> m_data;
+};
+
+} // namespace IPC
Modified: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp (224888 => 224889)
--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp 2017-11-15 19:22:44 UTC (rev 224888)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp 2017-11-15 19:28:03 UTC (rev 224889)
@@ -128,6 +128,11 @@
m_contentConnection->send(Messages::ServiceWorkerClientFetch::DidReceiveData { data, encodedDataLength }, fetchIdentifier);
}
+void WebSWServerConnection::didReceiveFetchFormData(uint64_t fetchIdentifier, const IPC::FormDataReference& formData)
+{
+ m_contentConnection->send(Messages::ServiceWorkerClientFetch::DidReceiveFormData { formData }, fetchIdentifier);
+}
+
void WebSWServerConnection::didFinishFetch(uint64_t fetchIdentifier)
{
m_contentConnection->send(Messages::ServiceWorkerClientFetch::DidFinish { }, fetchIdentifier);
Modified: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h (224888 => 224889)
--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h 2017-11-15 19:22:44 UTC (rev 224888)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h 2017-11-15 19:28:03 UTC (rev 224889)
@@ -32,6 +32,10 @@
#include <WebCore/SWServer.h>
#include <pal/SessionID.h>
+namespace IPC {
+class FormDataReference;
+}
+
namespace WebCore {
struct ExceptionData;
struct ServiceWorkerClientData;
@@ -53,6 +57,7 @@
void didReceiveFetchResponse(uint64_t fetchIdentifier, const WebCore::ResourceResponse&);
void didReceiveFetchData(uint64_t fetchIdentifier, const IPC::DataReference&, int64_t encodedDataLength);
+ void didReceiveFetchFormData(uint64_t fetchIdentifier, const IPC::FormDataReference&);
void didFinishFetch(uint64_t fetchIdentifier);
void didFailFetch(uint64_t fetchIdentifier);
void didNotHandleFetch(uint64_t fetchIdentifier);
Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.cpp (224888 => 224889)
--- trunk/Source/WebKit/StorageProcess/StorageProcess.cpp 2017-11-15 19:22:44 UTC (rev 224888)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.cpp 2017-11-15 19:28:03 UTC (rev 224889)
@@ -434,6 +434,12 @@
connection->didReceiveFetchData(fetchIdentifier, data, encodedDataLength);
}
+void StorageProcess::didReceiveFetchFormData(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, const IPC::FormDataReference& formData)
+{
+ if (auto* connection = m_swServerConnections.get(serverConnectionIdentifier))
+ connection->didReceiveFetchFormData(fetchIdentifier, formData);
+}
+
void StorageProcess::didFinishFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier)
{
if (auto* connection = m_swServerConnections.get(serverConnectionIdentifier))
Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.h (224888 => 224889)
--- trunk/Source/WebKit/StorageProcess/StorageProcess.h 2017-11-15 19:22:44 UTC (rev 224888)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.h 2017-11-15 19:28:03 UTC (rev 224889)
@@ -35,6 +35,10 @@
#include <wtf/CrossThreadTask.h>
#include <wtf/Function.h>
+namespace IPC {
+class FormDataReference;
+}
+
namespace WebCore {
class SWServer;
struct SecurityOriginData;
@@ -122,6 +126,7 @@
void didReceiveFetchResponse(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, const WebCore::ResourceResponse&);
void didReceiveFetchData(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, const IPC::DataReference&, int64_t encodedDataLength);
+ void didReceiveFetchFormData(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, const IPC::FormDataReference&);
void didFinishFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier);
void didFailFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier);
void didNotHandleFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier);
Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.messages.in (224888 => 224889)
--- trunk/Source/WebKit/StorageProcess/StorageProcess.messages.in 2017-11-15 19:22:44 UTC (rev 224888)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.messages.in 2017-11-15 19:28:03 UTC (rev 224889)
@@ -42,6 +42,7 @@
DidFailFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier)
DidReceiveFetchResponse(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, WebCore::ResourceResponse response)
DidReceiveFetchData(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, IPC::DataReference data, int64_t encodedDataLength)
+ DidReceiveFetchFormData(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, IPC::FormDataReference data)
DidFinishFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier)
PostMessageToServiceWorkerClient(struct WebCore::ServiceWorkerClientIdentifier destinationIdentifier, IPC::DataReference message, WebCore::ServiceWorkerIdentifier sourceIdentifier, String sourceOrigin)
#endif
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (224888 => 224889)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2017-11-15 19:22:44 UTC (rev 224888)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2017-11-15 19:28:03 UTC (rev 224889)
@@ -3222,6 +3222,7 @@
414DEDC51F9E4BEC0047C40D /* ServiceWorkerFrameLoaderClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerFrameLoaderClient.cpp; sourceTree = "<group>"; };
414DEDD51F9EDDDF0047C40D /* ServiceWorkerProcessProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerProcessProxy.h; sourceTree = "<group>"; };
414DEDD61F9EDDE00047C40D /* ServiceWorkerProcessProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerProcessProxy.cpp; sourceTree = "<group>"; };
+ 4151E5C31FBB90A900E47E2D /* FormDataReference.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormDataReference.h; sourceTree = "<group>"; };
41897ECB1F415D5C0016FA42 /* WebCacheStorageConnection.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebCacheStorageConnection.messages.in; sourceTree = "<group>"; };
41897ECC1F415D5C0016FA42 /* WebCacheStorageProvider.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebCacheStorageProvider.cpp; sourceTree = "<group>"; };
41897ECD1F415D5C0016FA42 /* WebCacheStorageConnection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebCacheStorageConnection.h; sourceTree = "<group>"; };
@@ -5404,6 +5405,7 @@
BC032D9E10F437D10058C15A /* Decoder.h */,
BC032D9F10F437D10058C15A /* Encoder.cpp */,
BC032DA010F437D10058C15A /* Encoder.h */,
+ 4151E5C31FBB90A900E47E2D /* FormDataReference.h */,
C0CE72AC1247E78D00BC0EC4 /* HandleMessage.h */,
1AC4C82816B876A90069DCCD /* MessageFlags.h */,
1A3EED11161A53D600AEB4F5 /* MessageReceiver.h */,
Modified: trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.cpp (224888 => 224889)
--- trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.cpp 2017-11-15 19:22:44 UTC (rev 224888)
+++ trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.cpp 2017-11-15 19:28:03 UTC (rev 224889)
@@ -85,6 +85,11 @@
m_loader->didReceiveData(reinterpret_cast<const char*>(data.data()), data.size(), encodedDataLength, DataPayloadBytes);
}
+void ServiceWorkerClientFetch::didReceiveFormData(const IPC::FormDataReference&)
+{
+ // FIXME: Implement form data reading.
+}
+
void ServiceWorkerClientFetch::didFinish()
{
ASSERT(!m_callback);
Modified: trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.h (224888 => 224889)
--- trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.h 2017-11-15 19:22:44 UTC (rev 224888)
+++ trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.h 2017-11-15 19:28:03 UTC (rev 224889)
@@ -27,6 +27,7 @@
#if ENABLE(SERVICE_WORKER)
+#include "FormDataReference.h"
#include "MessageReceiver.h"
#include "MessageSender.h"
#include <WebCore/ResourceLoader.h>
@@ -56,6 +57,7 @@
void didReceiveResponse(WebCore::ResourceResponse&&);
void didReceiveData(const IPC::DataReference&, int64_t encodedDataLength);
+ void didReceiveFormData(const IPC::FormDataReference&);
void didFinish();
void didFail();
void didNotHandle();
Modified: trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.messages.in (224888 => 224889)
--- trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.messages.in 2017-11-15 19:22:44 UTC (rev 224888)
+++ trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.messages.in 2017-11-15 19:28:03 UTC (rev 224889)
@@ -25,6 +25,7 @@
messages -> ServiceWorkerClientFetch {
DidReceiveResponse(WebCore::ResourceResponse response)
DidReceiveData(IPC::DataReference data, int64_t encodedDataLength)
+ DidReceiveFormData(IPC::FormDataReference data)
DidFinish()
DidFail()
DidNotHandle()
Modified: trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp (224888 => 224889)
--- trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp 2017-11-15 19:22:44 UTC (rev 224888)
+++ trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp 2017-11-15 19:28:03 UTC (rev 224889)
@@ -29,6 +29,7 @@
#if ENABLE(SERVICE_WORKER)
#include "DataReference.h"
+#include "FormDataReference.h"
#include "StorageProcessMessages.h"
#include "WebCoreArgumentCoders.h"
#include <WebCore/ResourceResponse.h>
@@ -66,6 +67,14 @@
m_connection->send(Messages::StorageProcess::DidReceiveFetchData { m_serverConnectionIdentifier, m_fetchTaskIdentifier, dataReference, static_cast<int64_t>(buffer->size()) }, 0);
}
+void WebServiceWorkerFetchTaskClient::didReceiveFormData(Ref<FormData>&& formData)
+{
+ if (!m_connection)
+ return;
+
+ m_connection->send(Messages::StorageProcess::DidReceiveFetchFormData { m_serverConnectionIdentifier, m_fetchTaskIdentifier, IPC::FormDataReference { WTFMove(formData) } }, 0);
+}
+
void WebServiceWorkerFetchTaskClient::didFail()
{
if (!m_connection)
Modified: trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.h (224888 => 224889)
--- trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.h 2017-11-15 19:22:44 UTC (rev 224888)
+++ trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.h 2017-11-15 19:28:03 UTC (rev 224889)
@@ -46,6 +46,7 @@
void didReceiveResponse(const WebCore::ResourceResponse&) final;
void didReceiveData(Ref<WebCore::SharedBuffer>&&) final;
+ void didReceiveFormData(Ref<WebCore::FormData>&&) final;
void didFail() final;
void didFinish() final;
void didNotHandle() final;