Diff
Modified: trunk/LayoutTests/ChangeLog (225461 => 225462)
--- trunk/LayoutTests/ChangeLog 2017-12-03 21:34:30 UTC (rev 225461)
+++ trunk/LayoutTests/ChangeLog 2017-12-03 22:24:45 UTC (rev 225462)
@@ -1,5 +1,16 @@
2017-12-03 Chris Dumez <[email protected]>
+ Support serviceWorker.postMessage() inside service workers
+ https://bugs.webkit.org/show_bug.cgi?id=180328
+
+ Reviewed by Darin Adler.
+
+ Unskip WPT test that no longer times out.
+
+ * TestExpectations:
+
+2017-12-03 Chris Dumez <[email protected]>
+
Unreviewed, unskip / rebaseline a few web platform tests.
* TestExpectations:
Modified: trunk/LayoutTests/TestExpectations (225461 => 225462)
--- trunk/LayoutTests/TestExpectations 2017-12-03 21:34:30 UTC (rev 225461)
+++ trunk/LayoutTests/TestExpectations 2017-12-03 22:24:45 UTC (rev 225462)
@@ -145,7 +145,6 @@
# Skip service worker tests that are timing out.
imported/w3c/web-platform-tests/fetch/api/abort/general-serviceworker.https.html [ Skip ]
-imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/extendable-message-event.https.html [ Skip ]
imported/w3c/web-platform-tests/service-workers/service-worker/detached-context.https.html [ Skip ]
imported/w3c/web-platform-tests/service-workers/service-worker/extendable-event-waituntil.https.html [ Skip ]
imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-basics.https.html [ Skip ]
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (225461 => 225462)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2017-12-03 21:34:30 UTC (rev 225461)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2017-12-03 22:24:45 UTC (rev 225462)
@@ -1,5 +1,16 @@
2017-12-03 Chris Dumez <[email protected]>
+ Support serviceWorker.postMessage() inside service workers
+ https://bugs.webkit.org/show_bug.cgi?id=180328
+
+ Reviewed by Darin Adler.
+
+ Rebaseline WPT test that is now passing.
+
+ * web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/extendable-message-event.https-expected.txt:
+
+2017-12-03 Chris Dumez <[email protected]>
+
Unreviewed, unskip / rebaseline a few web platform tests.
* web-platform-tests/service-workers/cache-storage/serviceworker/cache-match.https-expected.txt:
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/extendable-message-event.https-expected.txt (225461 => 225462)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/extendable-message-event.https-expected.txt 2017-12-03 21:34:30 UTC (rev 225461)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/extendable-message-event.https-expected.txt 2017-12-03 22:24:45 UTC (rev 225462)
@@ -1,8 +1,6 @@
-Harness Error (TIMEOUT), message = null
-
FAIL Post an extendable message from a top-level client promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
FAIL Post an extendable message from a nested client assert_equals: event `source` property `focused` expected false but got true
-TIMEOUT Post loopback extendable messages Test timed out
-NOTRUN Post extendable messages among service workers
+PASS Post loopback extendable messages
+PASS Post extendable messages among service workers
Modified: trunk/Source/WebCore/ChangeLog (225461 => 225462)
--- trunk/Source/WebCore/ChangeLog 2017-12-03 21:34:30 UTC (rev 225461)
+++ trunk/Source/WebCore/ChangeLog 2017-12-03 22:24:45 UTC (rev 225462)
@@ -1,5 +1,28 @@
2017-12-03 Chris Dumez <[email protected]>
+ Support serviceWorker.postMessage() inside service workers
+ https://bugs.webkit.org/show_bug.cgi?id=180328
+
+ Reviewed by Darin Adler.
+
+ Support serviceWorker.postMessage() inside service workers.
+
+ No new tests, unskipped and rebaselined existing test that is
+ now passing.
+
+ * workers/service/SWClientConnection.h:
+ * workers/service/ServiceWorker.cpp:
+ (WebCore::ServiceWorker::postMessage):
+ * workers/service/context/SWContextManager.cpp:
+ (WebCore::SWContextManager::postMessageToServiceWorker):
+ * workers/service/context/SWContextManager.h:
+ * workers/service/context/ServiceWorkerThread.cpp:
+ (WebCore::fireMessageEvent):
+ (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
+ * workers/service/context/ServiceWorkerThread.h:
+
+2017-12-03 Chris Dumez <[email protected]>
+
Implement self.skipWaiting() inside service workers
https://bugs.webkit.org/show_bug.cgi?id=180329
Modified: trunk/Source/WebCore/workers/service/SWClientConnection.h (225461 => 225462)
--- trunk/Source/WebCore/workers/service/SWClientConnection.h 2017-12-03 21:34:30 UTC (rev 225461)
+++ trunk/Source/WebCore/workers/service/SWClientConnection.h 2017-12-03 22:24:45 UTC (rev 225462)
@@ -47,6 +47,7 @@
enum class ShouldNotifyWhenResolved;
struct ExceptionData;
struct ServiceWorkerClientData;
+struct ServiceWorkerClientIdentifier;
struct ServiceWorkerData;
struct ServiceWorkerFetchResult;
struct ServiceWorkerRegistrationData;
@@ -70,7 +71,9 @@
virtual void didResolveRegistrationPromise(const ServiceWorkerRegistrationKey&) = 0;
- virtual void postMessageToServiceWorkerGlobalScope(ServiceWorkerIdentifier destinationIdentifier, Ref<SerializedScriptValue>&&, DocumentIdentifier sourceContextIdentifier, ServiceWorkerClientData&& source) = 0;
+ virtual void postMessageToServiceWorker(ServiceWorkerIdentifier destination, Ref<SerializedScriptValue>&& message, ServiceWorkerClientIdentifier sourceIdentifier, ServiceWorkerClientData&& sourceData) = 0;
+ virtual void postMessageToServiceWorker(ServiceWorkerIdentifier destination, Ref<SerializedScriptValue>&& message, ServiceWorkerIdentifier source) = 0;
+
virtual SWServerConnectionIdentifier serverConnectionIdentifier() const = 0;
virtual bool mayHaveServiceWorkerRegisteredForOrigin(const SecurityOrigin&) const = 0;
virtual void syncTerminateWorker(ServiceWorkerIdentifier) = 0;
Modified: trunk/Source/WebCore/workers/service/ServiceWorker.cpp (225461 => 225462)
--- trunk/Source/WebCore/workers/service/ServiceWorker.cpp 2017-12-03 21:34:30 UTC (rev 225461)
+++ trunk/Source/WebCore/workers/service/ServiceWorker.cpp 2017-12-03 22:24:45 UTC (rev 225462)
@@ -35,6 +35,7 @@
#include "ScriptExecutionContext.h"
#include "SerializedScriptValue.h"
#include "ServiceWorkerClientData.h"
+#include "ServiceWorkerGlobalScope.h"
#include "ServiceWorkerProvider.h"
#include <runtime/JSCJSValueInlines.h>
#include <wtf/NeverDestroyed.h>
@@ -110,15 +111,20 @@
if (channels && !channels->isEmpty())
return Exception { NotSupportedError, ASCIILiteral("Passing MessagePort objects to postMessage is not yet supported") };
- // FIXME: We should add support for workers.
- if (!is<Document>(context))
- return Exception { NotSupportedError, ASCIILiteral("serviceWorkerClient.postMessage() from workers is not yet supported") };
+ if (is<ServiceWorkerGlobalScope>(context)) {
+ auto sourceWorkerIdentifier = downcast<ServiceWorkerGlobalScope>(context).thread().identifier();
+ callOnMainThread([sessionID = context.sessionID(), destinationIdentifier = identifier(), sourceWorkerIdentifier, message = WTFMove(message)]() mutable {
+ auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(sessionID);
+ connection.postMessageToServiceWorker(destinationIdentifier, message.releaseReturnValue(), sourceWorkerIdentifier);
+ });
+ return { };
+ }
auto sourceClientData = ServiceWorkerClientData::from(context);
+ auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(context.sessionID());
+ ServiceWorkerClientIdentifier sourceClientIdentifier { connection.serverConnectionIdentifier(), downcast<Document>(context).identifier() };
+ connection.postMessageToServiceWorker(identifier(), message.releaseReturnValue(), WTFMove(sourceClientIdentifier), WTFMove(sourceClientData));
- auto& swConnection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(context.sessionID());
- swConnection.postMessageToServiceWorkerGlobalScope(identifier(), message.releaseReturnValue(), downcast<Document>(context).identifier(), WTFMove(sourceClientData));
-
return { };
}
Modified: trunk/Source/WebCore/workers/service/context/SWContextManager.cpp (225461 => 225462)
--- trunk/Source/WebCore/workers/service/context/SWContextManager.cpp 2017-12-03 21:34:30 UTC (rev 225461)
+++ trunk/Source/WebCore/workers/service/context/SWContextManager.cpp 2017-12-03 22:24:45 UTC (rev 225462)
@@ -67,7 +67,7 @@
return m_workerMap.get(identifier);
}
-void SWContextManager::postMessageToServiceWorkerGlobalScope(ServiceWorkerIdentifier destination, Ref<SerializedScriptValue>&& message, ServiceWorkerClientIdentifier sourceIdentifier, ServiceWorkerClientData&& sourceData)
+void SWContextManager::postMessageToServiceWorker(ServiceWorkerIdentifier destination, Ref<SerializedScriptValue>&& message, ServiceWorkerClientIdentifier sourceIdentifier, ServiceWorkerClientData&& sourceData)
{
auto* serviceWorker = m_workerMap.get(destination);
ASSERT(serviceWorker);
@@ -74,9 +74,19 @@
ASSERT(!serviceWorker->isTerminatingOrTerminated());
// FIXME: We should pass valid MessagePortChannels.
- serviceWorker->thread().postMessageToServiceWorkerGlobalScope(WTFMove(message), nullptr, sourceIdentifier, WTFMove(sourceData));
+ serviceWorker->thread().postMessageToServiceWorker(WTFMove(message), nullptr, sourceIdentifier, WTFMove(sourceData));
}
+void SWContextManager::postMessageToServiceWorker(ServiceWorkerIdentifier destination, Ref<SerializedScriptValue>&& message, ServiceWorkerData&& sourceData)
+{
+ auto* serviceWorker = m_workerMap.get(destination);
+ ASSERT(serviceWorker);
+ ASSERT(!serviceWorker->isTerminatingOrTerminated());
+
+ // FIXME: We should pass valid MessagePortChannels.
+ serviceWorker->thread().postMessageToServiceWorker(WTFMove(message), nullptr, WTFMove(sourceData));
+}
+
void SWContextManager::fireInstallEvent(ServiceWorkerIdentifier identifier)
{
auto* serviceWorker = m_workerMap.get(identifier);
Modified: trunk/Source/WebCore/workers/service/context/SWContextManager.h (225461 => 225462)
--- trunk/Source/WebCore/workers/service/context/SWContextManager.h 2017-12-03 21:34:30 UTC (rev 225461)
+++ trunk/Source/WebCore/workers/service/context/SWContextManager.h 2017-12-03 22:24:45 UTC (rev 225462)
@@ -66,7 +66,8 @@
WEBCORE_EXPORT void registerServiceWorkerThreadForInstall(Ref<ServiceWorkerThreadProxy>&&);
WEBCORE_EXPORT ServiceWorkerThreadProxy* serviceWorkerThreadProxy(ServiceWorkerIdentifier) const;
- WEBCORE_EXPORT void postMessageToServiceWorkerGlobalScope(ServiceWorkerIdentifier destination, Ref<SerializedScriptValue>&& message, ServiceWorkerClientIdentifier sourceIdentifier, ServiceWorkerClientData&& sourceData);
+ WEBCORE_EXPORT void postMessageToServiceWorker(ServiceWorkerIdentifier destination, Ref<SerializedScriptValue>&& message, ServiceWorkerClientIdentifier sourceIdentifier, ServiceWorkerClientData&& sourceData);
+ WEBCORE_EXPORT void postMessageToServiceWorker(ServiceWorkerIdentifier destination, Ref<SerializedScriptValue>&& message, ServiceWorkerData&& sourceData);
WEBCORE_EXPORT void fireInstallEvent(ServiceWorkerIdentifier);
WEBCORE_EXPORT void fireActivateEvent(ServiceWorkerIdentifier);
WEBCORE_EXPORT void terminateWorker(ServiceWorkerIdentifier, Function<void()>&&);
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp (225461 => 225462)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp 2017-12-03 21:34:30 UTC (rev 225461)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp 2017-12-03 22:24:45 UTC (rev 225462)
@@ -105,21 +105,35 @@
}, WorkerRunLoop::defaultMode());
}
-void ServiceWorkerThread::postMessageToServiceWorkerGlobalScope(Ref<SerializedScriptValue>&& message, std::unique_ptr<MessagePortChannelArray>&& channels, ServiceWorkerClientIdentifier sourceIdentifier, ServiceWorkerClientData&& sourceData)
+static void fireMessageEvent(ServiceWorkerGlobalScope& scope, Ref<SerializedScriptValue>&& message, std::unique_ptr<MessagePortChannelArray>&& channels, ExtendableMessageEventSource&& source, Ref<SecurityOrigin>&& sourceOrigin)
{
- ScriptExecutionContext::Task task([channels = WTFMove(channels), message = WTFMove(message), sourceIdentifier, sourceData = sourceData.isolatedCopy()] (ScriptExecutionContext& context) mutable {
+ auto ports = MessagePort::entanglePorts(scope, WTFMove(channels));
+ auto messageEvent = ExtendableMessageEvent::create(WTFMove(ports), WTFMove(message), sourceOrigin->toString(), { }, source);
+ scope.dispatchEvent(messageEvent);
+ scope.thread().workerObjectProxy().confirmMessageFromWorkerObject(scope.hasPendingActivity());
+ scope.updateExtendedEventsSet(messageEvent.ptr());
+}
+
+void ServiceWorkerThread::postMessageToServiceWorker(Ref<SerializedScriptValue>&& message, std::unique_ptr<MessagePortChannelArray>&& channels, ServiceWorkerClientIdentifier sourceIdentifier, ServiceWorkerClientData&& sourceData)
+{
+ runLoop().postTask([channels = WTFMove(channels), message = WTFMove(message), sourceIdentifier, sourceData = sourceData.isolatedCopy()] (auto& context) mutable {
auto& serviceWorkerGlobalScope = downcast<ServiceWorkerGlobalScope>(context);
- auto ports = MessagePort::entanglePorts(serviceWorkerGlobalScope, WTFMove(channels));
RefPtr<ServiceWorkerClient> source = ServiceWorkerClient::getOrCreate(serviceWorkerGlobalScope, sourceIdentifier, WTFMove(sourceData));
auto sourceOrigin = SecurityOrigin::create(source->url());
- auto messageEvent = ExtendableMessageEvent::create(WTFMove(ports), WTFMove(message), sourceOrigin->toString(), { }, ExtendableMessageEventSource { source });
- serviceWorkerGlobalScope.dispatchEvent(messageEvent);
- serviceWorkerGlobalScope.thread().workerObjectProxy().confirmMessageFromWorkerObject(serviceWorkerGlobalScope.hasPendingActivity());
- serviceWorkerGlobalScope.updateExtendedEventsSet(messageEvent.ptr());
+ fireMessageEvent(serviceWorkerGlobalScope, WTFMove(message), WTFMove(channels), ExtendableMessageEventSource { source }, WTFMove(sourceOrigin));
});
- runLoop().postTask(WTFMove(task));
}
+void ServiceWorkerThread::postMessageToServiceWorker(Ref<SerializedScriptValue>&& message, std::unique_ptr<MessagePortChannelArray>&& channels, ServiceWorkerData&& sourceData)
+{
+ runLoop().postTask([channels = WTFMove(channels), message = WTFMove(message), sourceData = sourceData.isolatedCopy()] (auto& context) mutable {
+ auto& serviceWorkerGlobalScope = downcast<ServiceWorkerGlobalScope>(context);
+ RefPtr<ServiceWorker> source = ServiceWorker::getOrCreate(serviceWorkerGlobalScope, WTFMove(sourceData));
+ auto sourceOrigin = SecurityOrigin::create(source->scriptURL());
+ fireMessageEvent(downcast<ServiceWorkerGlobalScope>(context), WTFMove(message), WTFMove(channels), ExtendableMessageEventSource { source }, WTFMove(sourceOrigin));
+ });
+}
+
void ServiceWorkerThread::fireInstallEvent()
{
ScriptExecutionContext::Task task([jobDataIdentifier = m_data.jobDataIdentifier, serviceWorkerIdentifier = this->identifier()] (ScriptExecutionContext& context) mutable {
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.h (225461 => 225462)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.h 2017-12-03 21:34:30 UTC (rev 225461)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.h 2017-12-03 22:24:45 UTC (rev 225462)
@@ -58,7 +58,8 @@
WEBCORE_EXPORT void postFetchTask(Ref<ServiceWorkerFetch::Client>&&, ResourceRequest&&, FetchOptions&&);
WEBCORE_EXPORT void postFetchTask(Ref<ServiceWorkerFetch::Client>&&, std::optional<ServiceWorkerClientIdentifier>&&, ResourceRequest&&, FetchOptions&&);
- WEBCORE_EXPORT void postMessageToServiceWorkerGlobalScope(Ref<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>&&, ServiceWorkerClientIdentifier sourceIdentifier, ServiceWorkerClientData&& sourceData);
+ WEBCORE_EXPORT void postMessageToServiceWorker(Ref<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>&&, ServiceWorkerClientIdentifier sourceIdentifier, ServiceWorkerClientData&& sourceData);
+ WEBCORE_EXPORT void postMessageToServiceWorker(Ref<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>&&, ServiceWorkerData&& sourceData);
void fireInstallEvent();
void fireActivateEvent();
Modified: trunk/Source/WebKit/ChangeLog (225461 => 225462)
--- trunk/Source/WebKit/ChangeLog 2017-12-03 21:34:30 UTC (rev 225461)
+++ trunk/Source/WebKit/ChangeLog 2017-12-03 22:24:45 UTC (rev 225462)
@@ -1,5 +1,28 @@
2017-12-03 Chris Dumez <[email protected]>
+ Support serviceWorker.postMessage() inside service workers
+ https://bugs.webkit.org/show_bug.cgi?id=180328
+
+ Reviewed by Darin Adler.
+
+ Support serviceWorker.postMessage() inside service workers.
+
+ * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
+ (WebKit::WebSWServerConnection::postMessageToServiceWorkerFromClient):
+ (WebKit::WebSWServerConnection::postMessageToServiceWorkerFromServiceWorker):
+ * StorageProcess/ServiceWorker/WebSWServerConnection.h:
+ * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
+ * WebProcess/Storage/WebSWClientConnection.cpp:
+ (WebKit::WebSWClientConnection::postMessageToServiceWorker):
+ * WebProcess/Storage/WebSWClientConnection.h:
+ * WebProcess/Storage/WebSWContextManagerConnection.cpp:
+ (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerFromClient):
+ (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerFromServiceWorker):
+ * WebProcess/Storage/WebSWContextManagerConnection.h:
+ * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
+
+2017-12-03 Chris Dumez <[email protected]>
+
Implement self.skipWaiting() inside service workers
https://bugs.webkit.org/show_bug.cgi?id=180329
Modified: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp (225461 => 225462)
--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp 2017-12-03 21:34:30 UTC (rev 225461)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp 2017-12-03 22:24:45 UTC (rev 225462)
@@ -128,16 +128,28 @@
sendToContextProcess(Messages::WebSWContextManagerConnection::StartFetch { identifier(), fetchIdentifier, serviceWorkerIdentifier, request, options, formData });
}
-void WebSWServerConnection::postMessageToServiceWorkerGlobalScope(ServiceWorkerIdentifier destinationServiceWorkerIdentifier, const IPC::DataReference& message, DocumentIdentifier sourceContextIdentifier, ServiceWorkerClientData&& sourceData)
+void WebSWServerConnection::postMessageToServiceWorkerFromClient(ServiceWorkerIdentifier destinationIdentifier, const IPC::DataReference& message, ServiceWorkerClientIdentifier sourceIdentifier, ServiceWorkerClientData&& sourceData)
{
// It's possible this specific worker cannot be re-run (e.g. its registration has been removed)
- if (!server().invokeRunServiceWorker(destinationServiceWorkerIdentifier))
+ if (!server().invokeRunServiceWorker(destinationIdentifier))
return;
- ServiceWorkerClientIdentifier sourceIdentifier { identifier(), sourceContextIdentifier };
- sendToContextProcess(Messages::WebSWContextManagerConnection::PostMessageToServiceWorkerGlobalScope { destinationServiceWorkerIdentifier, message, sourceIdentifier, WTFMove(sourceData) });
+ sendToContextProcess(Messages::WebSWContextManagerConnection::PostMessageToServiceWorkerFromClient { destinationIdentifier, message, sourceIdentifier, WTFMove(sourceData) });
}
+void WebSWServerConnection::postMessageToServiceWorkerFromServiceWorker(ServiceWorkerIdentifier destinationIdentifier, const IPC::DataReference& message, ServiceWorkerIdentifier sourceIdentifier)
+{
+ // It's possible this specific worker cannot be re-run (e.g. its registration has been removed)
+ if (!server().invokeRunServiceWorker(destinationIdentifier))
+ return;
+
+ auto* sourceWorker = server().workerByID(sourceIdentifier);
+ if (!sourceWorker)
+ return;
+
+ sendToContextProcess(Messages::WebSWContextManagerConnection::PostMessageToServiceWorkerFromServiceWorker { destinationIdentifier, message, sourceWorker->data() });
+}
+
void WebSWServerConnection::didReceiveFetchResponse(uint64_t fetchIdentifier, const ResourceResponse& response)
{
m_contentConnection->send(Messages::ServiceWorkerClientFetch::DidReceiveResponse { response }, fetchIdentifier);
Modified: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h (225461 => 225462)
--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h 2017-12-03 21:34:30 UTC (rev 225461)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h 2017-12-03 22:24:45 UTC (rev 225462)
@@ -80,7 +80,8 @@
void startFetch(uint64_t fetchIdentifier, std::optional<WebCore::ServiceWorkerIdentifier>, const WebCore::ResourceRequest&, const WebCore::FetchOptions&, const IPC::FormDataReference&);
- void postMessageToServiceWorkerGlobalScope(WebCore::ServiceWorkerIdentifier destinationIdentifier, const IPC::DataReference& message, WebCore::DocumentIdentifier sourceContextIdentifier, WebCore::ServiceWorkerClientData&& source);
+ void postMessageToServiceWorkerFromClient(WebCore::ServiceWorkerIdentifier destination, const IPC::DataReference& message, WebCore::ServiceWorkerClientIdentifier sourceIdentifier, WebCore::ServiceWorkerClientData&& source);
+ void postMessageToServiceWorkerFromServiceWorker(WebCore::ServiceWorkerIdentifier destination, const IPC::DataReference& message, WebCore::ServiceWorkerIdentifier source);
void matchRegistration(uint64_t registrationMatchRequestIdentifier, const WebCore::SecurityOriginData& topOrigin, const WebCore::URL& clientURL);
void getRegistrations(uint64_t registrationMatchRequestIdentifier, const WebCore::SecurityOriginData& topOrigin, const WebCore::URL& clientURL);
Modified: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in (225461 => 225462)
--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in 2017-12-03 21:34:30 UTC (rev 225461)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in 2017-12-03 22:24:45 UTC (rev 225462)
@@ -32,7 +32,8 @@
ServiceWorkerStoppedControllingClient(WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, WebCore::ServiceWorkerRegistrationIdentifier registrationIdentifier, WebCore::DocumentIdentifier contextIdentifier)
StartFetch(uint64_t identifier, std::optional<WebCore::ServiceWorkerIdentifier> serviceWorkerIdentifier, WebCore::ResourceRequest request, struct WebCore::FetchOptions options, IPC::FormDataReference requestBody)
- PostMessageToServiceWorkerGlobalScope(WebCore::ServiceWorkerIdentifier destinationServiceWorkerIdentifier, IPC::DataReference message, WebCore::DocumentIdentifier sourceContextIdentifier, struct WebCore::ServiceWorkerClientData source)
+ PostMessageToServiceWorkerFromClient(WebCore::ServiceWorkerIdentifier destinationServiceWorkerIdentifier, IPC::DataReference message, struct WebCore::ServiceWorkerClientIdentifier sourceIdentifier, struct WebCore::ServiceWorkerClientData sourceData)
+ PostMessageToServiceWorkerFromServiceWorker(WebCore::ServiceWorkerIdentifier destinationServiceWorkerIdentifier, IPC::DataReference message, struct WebCore::ServiceWorkerIdentifier sourceIdentifier)
DidResolveRegistrationPromise(WebCore::ServiceWorkerRegistrationKey key)
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp (225461 => 225462)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp 2017-12-03 21:34:30 UTC (rev 225461)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp 2017-12-03 22:24:45 UTC (rev 225462)
@@ -82,11 +82,16 @@
send(Messages::WebSWServerConnection::RemoveServiceWorkerRegistrationInServer(identifier));
}
-void WebSWClientConnection::postMessageToServiceWorkerGlobalScope(ServiceWorkerIdentifier destinationIdentifier, Ref<SerializedScriptValue>&& scriptValue, DocumentIdentifier sourceContextIdentifier, ServiceWorkerClientData&& source)
+void WebSWClientConnection::postMessageToServiceWorker(ServiceWorkerIdentifier destinationIdentifier, Ref<SerializedScriptValue>&& scriptValue, ServiceWorkerClientIdentifier sourceIdentifier, ServiceWorkerClientData&& source)
{
- send(Messages::WebSWServerConnection::PostMessageToServiceWorkerGlobalScope(destinationIdentifier, IPC::DataReference { scriptValue->data() }, sourceContextIdentifier, WTFMove(source)));
+ send(Messages::WebSWServerConnection::PostMessageToServiceWorkerFromClient(destinationIdentifier, IPC::DataReference { scriptValue->data() }, sourceIdentifier, WTFMove(source)));
}
+void WebSWClientConnection::postMessageToServiceWorker(ServiceWorkerIdentifier destinationIdentifier, Ref<SerializedScriptValue>&& scriptValue, ServiceWorkerIdentifier sourceWorkerIdentifier)
+{
+ send(Messages::WebSWServerConnection::PostMessageToServiceWorkerFromServiceWorker(destinationIdentifier, IPC::DataReference { scriptValue->data() }, sourceWorkerIdentifier));
+}
+
void WebSWClientConnection::serviceWorkerStartedControllingClient(ServiceWorkerIdentifier serviceWorkerIdentifier, ServiceWorkerRegistrationIdentifier registrationIdentifier, DocumentIdentifier contextIdentifier)
{
send(Messages::WebSWServerConnection::ServiceWorkerStartedControllingClient(serviceWorkerIdentifier, registrationIdentifier, contextIdentifier));
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h (225461 => 225462)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h 2017-12-03 21:34:30 UTC (rev 225461)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h 2017-12-03 22:24:45 UTC (rev 225462)
@@ -73,7 +73,8 @@
void scheduleJobInServer(const WebCore::ServiceWorkerJobData&) final;
void finishFetchingScriptInServer(const WebCore::ServiceWorkerFetchResult&) final;
- void postMessageToServiceWorkerGlobalScope(WebCore::ServiceWorkerIdentifier destinationIdentifier, Ref<WebCore::SerializedScriptValue>&&, WebCore::DocumentIdentifier sourceContextIdentifier, WebCore::ServiceWorkerClientData&& source) final;
+ void postMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destinationIdentifier, Ref<WebCore::SerializedScriptValue>&&, WebCore::ServiceWorkerClientIdentifier sourceIdentifier, WebCore::ServiceWorkerClientData&& source) final;
+ void postMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destinationIdentifier, Ref<WebCore::SerializedScriptValue>&&, WebCore::ServiceWorkerIdentifier sourceWorkerIdentifier) final;
void serviceWorkerStartedControllingClient(WebCore::ServiceWorkerIdentifier, WebCore::ServiceWorkerRegistrationIdentifier, WebCore::DocumentIdentifier) final;
void serviceWorkerStoppedControllingClient(WebCore::ServiceWorkerIdentifier, WebCore::ServiceWorkerRegistrationIdentifier, WebCore::DocumentIdentifier) final;
void registerServiceWorkerClient(const WebCore::SecurityOrigin& topOrigin, WebCore::DocumentIdentifier, const WebCore::ServiceWorkerClientData&) final;
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp (225461 => 225462)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp 2017-12-03 21:34:30 UTC (rev 225461)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp 2017-12-03 22:24:45 UTC (rev 225462)
@@ -150,11 +150,16 @@
serviceWorkerThreadProxy->thread().postFetchTask(WTFMove(client), WTFMove(clientId), WTFMove(request), WTFMove(options));
}
-void WebSWContextManagerConnection::postMessageToServiceWorkerGlobalScope(ServiceWorkerIdentifier destinationIdentifier, const IPC::DataReference& message, ServiceWorkerClientIdentifier sourceIdentifier, ServiceWorkerClientData&& sourceData)
+void WebSWContextManagerConnection::postMessageToServiceWorkerFromClient(ServiceWorkerIdentifier destinationIdentifier, const IPC::DataReference& message, ServiceWorkerClientIdentifier sourceIdentifier, ServiceWorkerClientData&& sourceData)
{
- SWContextManager::singleton().postMessageToServiceWorkerGlobalScope(destinationIdentifier, SerializedScriptValue::adopt(message.vector()), sourceIdentifier, WTFMove(sourceData));
+ SWContextManager::singleton().postMessageToServiceWorker(destinationIdentifier, SerializedScriptValue::adopt(message.vector()), sourceIdentifier, WTFMove(sourceData));
}
+void WebSWContextManagerConnection::postMessageToServiceWorkerFromServiceWorker(ServiceWorkerIdentifier destinationIdentifier, const IPC::DataReference& message, ServiceWorkerData&& sourceData)
+{
+ SWContextManager::singleton().postMessageToServiceWorker(destinationIdentifier, SerializedScriptValue::adopt(message.vector()), WTFMove(sourceData));
+}
+
void WebSWContextManagerConnection::fireInstallEvent(ServiceWorkerIdentifier identifier)
{
SWContextManager::singleton().fireInstallEvent(identifier);
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h (225461 => 225462)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h 2017-12-03 21:34:30 UTC (rev 225461)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h 2017-12-03 22:24:45 UTC (rev 225462)
@@ -72,7 +72,8 @@
void serviceWorkerStartedWithMessage(std::optional<WebCore::ServiceWorkerJobDataIdentifier>, WebCore::ServiceWorkerIdentifier, const String& exceptionMessage) final;
void installServiceWorker(const WebCore::ServiceWorkerContextData&);
void startFetch(WebCore::SWServerConnectionIdentifier, uint64_t fetchIdentifier, std::optional<WebCore::ServiceWorkerIdentifier>, WebCore::ResourceRequest&&, WebCore::FetchOptions&&, IPC::FormDataReference&&);
- void postMessageToServiceWorkerGlobalScope(WebCore::ServiceWorkerIdentifier destinationIdentifier, const IPC::DataReference& message, WebCore::ServiceWorkerClientIdentifier sourceIdentifier, WebCore::ServiceWorkerClientData&& sourceData);
+ void postMessageToServiceWorkerFromClient(WebCore::ServiceWorkerIdentifier destinationIdentifier, const IPC::DataReference& message, WebCore::ServiceWorkerClientIdentifier sourceIdentifier, WebCore::ServiceWorkerClientData&& sourceData);
+ void postMessageToServiceWorkerFromServiceWorker(WebCore::ServiceWorkerIdentifier destination, const IPC::DataReference& message, WebCore::ServiceWorkerData&& sourceData);
void fireInstallEvent(WebCore::ServiceWorkerIdentifier);
void fireActivateEvent(WebCore::ServiceWorkerIdentifier);
void terminateWorker(WebCore::ServiceWorkerIdentifier);
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in (225461 => 225462)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in 2017-12-03 21:34:30 UTC (rev 225461)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in 2017-12-03 22:24:45 UTC (rev 225462)
@@ -25,7 +25,8 @@
messages -> WebSWContextManagerConnection {
InstallServiceWorker(struct WebCore::ServiceWorkerContextData contextData)
StartFetch(WebCore::SWServerConnectionIdentifier serverConnectionIdentifier, uint64_t fetchIdentifier, std::optional<WebCore::ServiceWorkerIdentifier> serviceWorkerIdentifier, WebCore::ResourceRequest request, struct WebCore::FetchOptions options, IPC::FormDataReference requestBody)
- PostMessageToServiceWorkerGlobalScope(WebCore::ServiceWorkerIdentifier destinationIdentifier, IPC::DataReference message, struct WebCore::ServiceWorkerClientIdentifier sourceIdentifier, struct WebCore::ServiceWorkerClientData sourceData)
+ PostMessageToServiceWorkerFromClient(WebCore::ServiceWorkerIdentifier destinationIdentifier, IPC::DataReference message, struct WebCore::ServiceWorkerClientIdentifier sourceIdentifier, struct WebCore::ServiceWorkerClientData sourceData)
+ PostMessageToServiceWorkerFromServiceWorker(WebCore::ServiceWorkerIdentifier destinationIdentifier, IPC::DataReference message, struct WebCore::ServiceWorkerData sourceData)
FireInstallEvent(WebCore::ServiceWorkerIdentifier identifier)
FireActivateEvent(WebCore::ServiceWorkerIdentifier identifier)
TerminateWorker(WebCore::ServiceWorkerIdentifier identifier)