Diff
Modified: branches/safari-609-branch/Source/WebCore/ChangeLog (259507 => 259508)
--- branches/safari-609-branch/Source/WebCore/ChangeLog 2020-04-03 20:33:48 UTC (rev 259507)
+++ branches/safari-609-branch/Source/WebCore/ChangeLog 2020-04-03 20:39:48 UTC (rev 259508)
@@ -1,3 +1,76 @@
+2020-04-03 Alan Coon <[email protected]>
+
+ Cherry-pick r256900. rdar://problem/61269733
+
+ SWServer::claim should check for the service worker to be active
+ https://bugs.webkit.org/show_bug.cgi?id=207739
+ <rdar://problem/45441129>
+
+ Reviewed by Alex Christensen.
+
+ Source/WebCore:
+
+ claim is only working for service workers that are active.
+ But there might be a time when a service worker is active in its web process but redundant in networking process.
+ Thus, we need to move the check from WebProcess to NetworkProcess.
+
+ * workers/service/ServiceWorkerClients.cpp:
+ (WebCore::ServiceWorkerClients::claim):
+ * workers/service/context/SWContextManager.h:
+ * workers/service/server/SWServer.cpp:
+ (WebCore::SWServer::claim):
+ * workers/service/server/SWServer.h:
+ * workers/service/server/SWServerToContextConnection.cpp:
+ (WebCore::SWServerToContextConnection::claim):
+ * workers/service/server/SWServerToContextConnection.h:
+ * workers/service/server/SWServerWorker.cpp:
+ (WebCore::SWServerWorker::claim): Deleted.
+ * workers/service/server/SWServerWorker.h:
+ (WebCore::SWServerWorker::isActive const):
+
+ Source/WebKit:
+
+ Use Async Reply to remove the need for a map and passing integers around.
+
+ * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
+ (WebKit::WebSWServerToContextConnection::claimCompleted): Deleted.
+ * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
+ * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
+ * WebProcess/Storage/WebSWContextManagerConnection.cpp:
+ (WebKit::WebSWContextManagerConnection::claim):
+ (WebKit::WebSWContextManagerConnection::claimCompleted): Deleted.
+ * WebProcess/Storage/WebSWContextManagerConnection.h:
+ * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256900 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-02-18 Youenn Fablet <[email protected]>
+
+ SWServer::claim should check for the service worker to be active
+ https://bugs.webkit.org/show_bug.cgi?id=207739
+ <rdar://problem/45441129>
+
+ Reviewed by Alex Christensen.
+
+ claim is only working for service workers that are active.
+ But there might be a time when a service worker is active in its web process but redundant in networking process.
+ Thus, we need to move the check from WebProcess to NetworkProcess.
+
+ * workers/service/ServiceWorkerClients.cpp:
+ (WebCore::ServiceWorkerClients::claim):
+ * workers/service/context/SWContextManager.h:
+ * workers/service/server/SWServer.cpp:
+ (WebCore::SWServer::claim):
+ * workers/service/server/SWServer.h:
+ * workers/service/server/SWServerToContextConnection.cpp:
+ (WebCore::SWServerToContextConnection::claim):
+ * workers/service/server/SWServerToContextConnection.h:
+ * workers/service/server/SWServerWorker.cpp:
+ (WebCore::SWServerWorker::claim): Deleted.
+ * workers/service/server/SWServerWorker.h:
+ (WebCore::SWServerWorker::isActive const):
+
2020-03-31 Russell Epstein <[email protected]>
Cherry-pick r259305. rdar://problem/61131083
Modified: branches/safari-609-branch/Source/WebCore/workers/service/ServiceWorkerClients.cpp (259507 => 259508)
--- branches/safari-609-branch/Source/WebCore/workers/service/ServiceWorkerClients.cpp 2020-04-03 20:33:48 UTC (rev 259507)
+++ branches/safari-609-branch/Source/WebCore/workers/service/ServiceWorkerClients.cpp 2020-04-03 20:39:48 UTC (rev 259508)
@@ -116,20 +116,17 @@
auto serviceWorkerIdentifier = serviceWorkerGlobalScope.thread().identifier();
- if (!serviceWorkerGlobalScope.registration().active() || serviceWorkerGlobalScope.registration().active()->identifier() != serviceWorkerIdentifier) {
- promise->reject(Exception { InvalidStateError, "Service worker is not active"_s });
- return;
- }
-
auto promisePointer = promise.ptr();
m_pendingPromises.add(promisePointer, WTFMove(promise));
callOnMainThread([promisePointer, serviceWorkerIdentifier] () mutable {
auto connection = SWContextManager::singleton().connection();
- connection->claim(serviceWorkerIdentifier, [promisePointer, serviceWorkerIdentifier] () mutable {
- SWContextManager::singleton().postTaskToServiceWorker(serviceWorkerIdentifier, [promisePointer] (auto& scope) mutable {
- if (auto promise = scope.clients().m_pendingPromises.take(promisePointer))
- promise.value()->resolve();
+ connection->claim(serviceWorkerIdentifier, [promisePointer, serviceWorkerIdentifier](auto&& result) mutable {
+ SWContextManager::singleton().postTaskToServiceWorker(serviceWorkerIdentifier, [promisePointer, result = isolatedCopy(WTFMove(result))](auto& scope) mutable {
+ if (auto promise = scope.clients().m_pendingPromises.take(promisePointer)) {
+ DOMPromiseDeferred<void> pendingPromise { WTFMove(promise.value()) };
+ pendingPromise.settle(WTFMove(result));
+ }
});
});
});
Modified: branches/safari-609-branch/Source/WebCore/workers/service/context/SWContextManager.h (259507 => 259508)
--- branches/safari-609-branch/Source/WebCore/workers/service/context/SWContextManager.h 2020-04-03 20:33:48 UTC (rev 259507)
+++ branches/safari-609-branch/Source/WebCore/workers/service/context/SWContextManager.h 2020-04-03 20:39:48 UTC (rev 259508)
@@ -63,7 +63,7 @@
using FindClientByIdentifierCallback = CompletionHandler<void(ExceptionOr<Optional<ServiceWorkerClientData>>&&)>;
virtual void findClientByIdentifier(ServiceWorkerIdentifier, ServiceWorkerClientIdentifier, FindClientByIdentifierCallback&&) = 0;
virtual void matchAll(ServiceWorkerIdentifier, const ServiceWorkerClientQueryOptions&, ServiceWorkerClientsMatchAllCallback&&) = 0;
- virtual void claim(ServiceWorkerIdentifier, CompletionHandler<void()>&&) = 0;
+ virtual void claim(ServiceWorkerIdentifier, CompletionHandler<void(ExceptionOr<void>&&)>&&) = 0;
virtual void didFailHeartBeatCheck(ServiceWorkerIdentifier) = 0;
Modified: branches/safari-609-branch/Source/WebCore/workers/service/server/SWServer.cpp (259507 => 259508)
--- branches/safari-609-branch/Source/WebCore/workers/service/server/SWServer.cpp 2020-04-03 20:33:48 UTC (rev 259507)
+++ branches/safari-609-branch/Source/WebCore/workers/service/server/SWServer.cpp 2020-04-03 20:39:48 UTC (rev 259508)
@@ -548,8 +548,11 @@
}
}
-void SWServer::claim(SWServerWorker& worker)
+Optional<ExceptionData> SWServer::claim(SWServerWorker& worker)
{
+ if (!worker.isActive())
+ return ExceptionData { InvalidStateError, "Service worker is not active"_s };
+
auto& origin = worker.origin();
forEachClientForOrigin(origin, [&](auto& clientData) {
auto* registration = this->doRegistrationMatching(origin.topOrigin, clientData.url);
@@ -567,6 +570,7 @@
}
registration->controlClient(clientData.identifier);
});
+ return { };
}
void SWServer::didResolveRegistrationPromise(Connection* connection, const ServiceWorkerRegistrationKey& registrationKey)
Modified: branches/safari-609-branch/Source/WebCore/workers/service/server/SWServer.h (259507 => 259508)
--- branches/safari-609-branch/Source/WebCore/workers/service/server/SWServer.h 2020-04-03 20:33:48 UTC (rev 259507)
+++ branches/safari-609-branch/Source/WebCore/workers/service/server/SWServer.h 2020-04-03 20:39:48 UTC (rev 259508)
@@ -29,6 +29,7 @@
#include "ClientOrigin.h"
#include "DocumentIdentifier.h"
+#include "ExceptionOr.h"
#include "SWServerWorker.h"
#include "SecurityOriginData.h"
#include "ServiceWorkerClientData.h"
@@ -176,7 +177,7 @@
void didFinishActivation(SWServerWorker&);
void workerContextTerminated(SWServerWorker&);
void matchAll(SWServerWorker&, const ServiceWorkerClientQueryOptions&, ServiceWorkerClientsMatchAllCallback&&);
- void claim(SWServerWorker&);
+ Optional<ExceptionData> claim(SWServerWorker&);
WEBCORE_EXPORT static HashSet<SWServer*>& allServers();
Modified: branches/safari-609-branch/Source/WebCore/workers/service/server/SWServerToContextConnection.cpp (259507 => 259508)
--- branches/safari-609-branch/Source/WebCore/workers/service/server/SWServerToContextConnection.cpp 2020-04-03 20:33:48 UTC (rev 259507)
+++ branches/safari-609-branch/Source/WebCore/workers/service/server/SWServerToContextConnection.cpp 2020-04-03 20:39:48 UTC (rev 259508)
@@ -101,12 +101,11 @@
}
}
-void SWServerToContextConnection::claim(uint64_t requestIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier)
+void SWServerToContextConnection::claim(ServiceWorkerIdentifier serviceWorkerIdentifier, CompletionHandler<void(Optional<ExceptionData>&&)>&& callback)
{
- if (auto* worker = SWServerWorker::existingWorkerForIdentifier(serviceWorkerIdentifier)) {
- worker->claim();
- worker->contextConnection()->claimCompleted(requestIdentifier);
- }
+ auto* worker = SWServerWorker::existingWorkerForIdentifier(serviceWorkerIdentifier);
+ auto* server = worker ? worker->server() : nullptr;
+ callback(server ? server->claim(*worker) : WTF::nullopt);
}
void SWServerToContextConnection::skipWaiting(ServiceWorkerIdentifier serviceWorkerIdentifier, CompletionHandler<void()>&& completionHandler)
Modified: branches/safari-609-branch/Source/WebCore/workers/service/server/SWServerToContextConnection.h (259507 => 259508)
--- branches/safari-609-branch/Source/WebCore/workers/service/server/SWServerToContextConnection.h 2020-04-03 20:33:48 UTC (rev 259507)
+++ branches/safari-609-branch/Source/WebCore/workers/service/server/SWServerToContextConnection.h 2020-04-03 20:39:48 UTC (rev 259508)
@@ -27,6 +27,7 @@
#if ENABLE(SERVICE_WORKER)
+#include "ExceptionData.h"
#include "RegistrableDomain.h"
#include "ServiceWorkerClientQueryOptions.h"
#include "ServiceWorkerContextData.h"
@@ -56,7 +57,6 @@
virtual void syncTerminateWorker(ServiceWorkerIdentifier) = 0;
virtual void findClientByIdentifierCompleted(uint64_t requestIdentifier, const Optional<ServiceWorkerClientData>&, bool hasSecurityError) = 0;
virtual void matchAllCompleted(uint64_t requestIdentifier, const Vector<ServiceWorkerClientData>&) = 0;
- virtual void claimCompleted(uint64_t requestIdentifier) = 0;
// Messages back from the SW host process
WEBCORE_EXPORT void scriptContextFailedToStart(const Optional<ServiceWorkerJobDataIdentifier>&, ServiceWorkerIdentifier, const String& message);
@@ -68,7 +68,7 @@
WEBCORE_EXPORT void workerTerminated(ServiceWorkerIdentifier);
WEBCORE_EXPORT void findClientByIdentifier(uint64_t clientIdRequestIdentifier, ServiceWorkerIdentifier, ServiceWorkerClientIdentifier);
WEBCORE_EXPORT void matchAll(uint64_t requestIdentifier, ServiceWorkerIdentifier, const ServiceWorkerClientQueryOptions&);
- WEBCORE_EXPORT void claim(uint64_t requestIdentifier, ServiceWorkerIdentifier);
+ WEBCORE_EXPORT void claim(ServiceWorkerIdentifier, CompletionHandler<void(Optional<ExceptionData>&&)>&&);
WEBCORE_EXPORT void setScriptResource(ServiceWorkerIdentifier, URL&& scriptURL, String&& script, URL&& responseURL, String&& mimeType);
WEBCORE_EXPORT void didFailHeartBeatCheck(ServiceWorkerIdentifier);
Modified: branches/safari-609-branch/Source/WebCore/workers/service/server/SWServerWorker.cpp (259507 => 259508)
--- branches/safari-609-branch/Source/WebCore/workers/service/server/SWServerWorker.cpp 2020-04-03 20:33:48 UTC (rev 259507)
+++ branches/safari-609-branch/Source/WebCore/workers/service/server/SWServerWorker.cpp 2020-04-03 20:39:48 UTC (rev 259508)
@@ -172,13 +172,6 @@
return m_server->serviceWorkerClientUserAgent(origin());
}
-void SWServerWorker::claim()
-{
- ASSERT(m_server);
- if (m_server)
- m_server->claim(*this);
-}
-
void SWServerWorker::setScriptResource(URL&& url, ServiceWorkerContextData::ImportedScript&& script)
{
m_scriptResourceMap.set(WTFMove(url), WTFMove(script));
Modified: branches/safari-609-branch/Source/WebCore/workers/service/server/SWServerWorker.h (259507 => 259508)
--- branches/safari-609-branch/Source/WebCore/workers/service/server/SWServerWorker.h 2020-04-03 20:33:48 UTC (rev 259507)
+++ branches/safari-609-branch/Source/WebCore/workers/service/server/SWServerWorker.h 2020-04-03 20:39:48 UTC (rev 259508)
@@ -82,6 +82,8 @@
ServiceWorkerIdentifier identifier() const { return m_data.identifier; }
ServiceWorkerState state() const { return m_data.state; }
+ bool isActive() const { return m_data.state == ServiceWorkerState::Activated || m_data.state == ServiceWorkerState::Activating; }
+
void setState(ServiceWorkerState);
bool hasPendingEvents() const { return m_hasPendingEvents; }
@@ -94,7 +96,6 @@
void contextTerminated();
WEBCORE_EXPORT Optional<ServiceWorkerClientData> findClientByIdentifier(const ServiceWorkerClientIdentifier&) const;
void matchAll(const ServiceWorkerClientQueryOptions&, ServiceWorkerClientsMatchAllCallback&&);
- void claim();
void setScriptResource(URL&&, ServiceWorkerContextData::ImportedScript&&);
void skipWaiting();
Modified: branches/safari-609-branch/Source/WebKit/ChangeLog (259507 => 259508)
--- branches/safari-609-branch/Source/WebKit/ChangeLog 2020-04-03 20:33:48 UTC (rev 259507)
+++ branches/safari-609-branch/Source/WebKit/ChangeLog 2020-04-03 20:39:48 UTC (rev 259508)
@@ -1,3 +1,70 @@
+2020-04-03 Alan Coon <[email protected]>
+
+ Cherry-pick r256900. rdar://problem/61269733
+
+ SWServer::claim should check for the service worker to be active
+ https://bugs.webkit.org/show_bug.cgi?id=207739
+ <rdar://problem/45441129>
+
+ Reviewed by Alex Christensen.
+
+ Source/WebCore:
+
+ claim is only working for service workers that are active.
+ But there might be a time when a service worker is active in its web process but redundant in networking process.
+ Thus, we need to move the check from WebProcess to NetworkProcess.
+
+ * workers/service/ServiceWorkerClients.cpp:
+ (WebCore::ServiceWorkerClients::claim):
+ * workers/service/context/SWContextManager.h:
+ * workers/service/server/SWServer.cpp:
+ (WebCore::SWServer::claim):
+ * workers/service/server/SWServer.h:
+ * workers/service/server/SWServerToContextConnection.cpp:
+ (WebCore::SWServerToContextConnection::claim):
+ * workers/service/server/SWServerToContextConnection.h:
+ * workers/service/server/SWServerWorker.cpp:
+ (WebCore::SWServerWorker::claim): Deleted.
+ * workers/service/server/SWServerWorker.h:
+ (WebCore::SWServerWorker::isActive const):
+
+ Source/WebKit:
+
+ Use Async Reply to remove the need for a map and passing integers around.
+
+ * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
+ (WebKit::WebSWServerToContextConnection::claimCompleted): Deleted.
+ * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
+ * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
+ * WebProcess/Storage/WebSWContextManagerConnection.cpp:
+ (WebKit::WebSWContextManagerConnection::claim):
+ (WebKit::WebSWContextManagerConnection::claimCompleted): Deleted.
+ * WebProcess/Storage/WebSWContextManagerConnection.h:
+ * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256900 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-02-18 Youenn Fablet <[email protected]>
+
+ SWServer::claim should check for the service worker to be active
+ https://bugs.webkit.org/show_bug.cgi?id=207739
+ <rdar://problem/45441129>
+
+ Reviewed by Alex Christensen.
+
+ Use Async Reply to remove the need for a map and passing integers around.
+
+ * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
+ (WebKit::WebSWServerToContextConnection::claimCompleted): Deleted.
+ * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
+ * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
+ * WebProcess/Storage/WebSWContextManagerConnection.cpp:
+ (WebKit::WebSWContextManagerConnection::claim):
+ (WebKit::WebSWContextManagerConnection::claimCompleted): Deleted.
+ * WebProcess/Storage/WebSWContextManagerConnection.h:
+ * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
+
2020-03-30 Alan Coon <[email protected]>
Cherry-pick r259056. rdar://problem/61064876
Modified: branches/safari-609-branch/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp (259507 => 259508)
--- branches/safari-609-branch/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp 2020-04-03 20:33:48 UTC (rev 259507)
+++ branches/safari-609-branch/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp 2020-04-03 20:39:48 UTC (rev 259508)
@@ -122,11 +122,6 @@
send(Messages::WebSWContextManagerConnection::MatchAllCompleted { requestIdentifier, clientsData });
}
-void WebSWServerToContextConnection::claimCompleted(uint64_t requestIdentifier)
-{
- send(Messages::WebSWContextManagerConnection::ClaimCompleted { requestIdentifier });
-}
-
void WebSWServerToContextConnection::connectionIsNoLongerNeeded()
{
m_connection.serverToContextConnectionNoLongerNeeded();
Modified: branches/safari-609-branch/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h (259507 => 259508)
--- branches/safari-609-branch/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h 2020-04-03 20:33:48 UTC (rev 259507)
+++ branches/safari-609-branch/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h 2020-04-03 20:39:48 UTC (rev 259508)
@@ -90,7 +90,6 @@
void syncTerminateWorker(WebCore::ServiceWorkerIdentifier) final;
void findClientByIdentifierCompleted(uint64_t requestIdentifier, const Optional<WebCore::ServiceWorkerClientData>&, bool hasSecurityError) final;
void matchAllCompleted(uint64_t requestIdentifier, const Vector<WebCore::ServiceWorkerClientData>&) final;
- void claimCompleted(uint64_t requestIdentifier) final;
void connectionIsNoLongerNeeded() final;
Modified: branches/safari-609-branch/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in (259507 => 259508)
--- branches/safari-609-branch/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in 2020-04-03 20:33:48 UTC (rev 259507)
+++ branches/safari-609-branch/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in 2020-04-03 20:39:48 UTC (rev 259508)
@@ -25,19 +25,19 @@
messages -> WebSWServerToContextConnection NotRefCounted {
# When possible, these messages can be implemented directly by WebCore::SWServerToContextConnection
- ScriptContextFailedToStart(Optional<WebCore::ServiceWorkerJobDataIdentifier> jobDataIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, String message);
- ScriptContextStarted(Optional<WebCore::ServiceWorkerJobDataIdentifier> jobDataIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, bool doesHandleFetch);
- DidFinishInstall(Optional<WebCore::ServiceWorkerJobDataIdentifier> jobDataIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, bool wasSuccessful);
- DidFinishActivation(WebCore::ServiceWorkerIdentifier identifier);
- SetServiceWorkerHasPendingEvents(WebCore::ServiceWorkerIdentifier identifier, bool hasPendingEvents);
+ ScriptContextFailedToStart(Optional<WebCore::ServiceWorkerJobDataIdentifier> jobDataIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, String message)
+ ScriptContextStarted(Optional<WebCore::ServiceWorkerJobDataIdentifier> jobDataIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, bool doesHandleFetch)
+ DidFinishInstall(Optional<WebCore::ServiceWorkerJobDataIdentifier> jobDataIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, bool wasSuccessful)
+ DidFinishActivation(WebCore::ServiceWorkerIdentifier identifier)
+ SetServiceWorkerHasPendingEvents(WebCore::ServiceWorkerIdentifier identifier, bool hasPendingEvents)
SkipWaiting(WebCore::ServiceWorkerIdentifier identifier) -> () Async
- WorkerTerminated(WebCore::ServiceWorkerIdentifier identifier);
- FindClientByIdentifier(uint64_t requestIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, struct WebCore::ServiceWorkerClientIdentifier clientIdentifier);
+ WorkerTerminated(WebCore::ServiceWorkerIdentifier identifier)
+ FindClientByIdentifier(uint64_t requestIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, struct WebCore::ServiceWorkerClientIdentifier clientIdentifier)
MatchAll(uint64_t matchAllRequestIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, struct WebCore::ServiceWorkerClientQueryOptions options);
- Claim(uint64_t claimRequestIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier);
- SetScriptResource(WebCore::ServiceWorkerIdentifier identifier, URL scriptURL, String script, URL responseURL, String mimeType);
+ Claim(WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier) -> (Optional<WebCore::ExceptionData> result) Async
+ SetScriptResource(WebCore::ServiceWorkerIdentifier identifier, URL scriptURL, String script, URL responseURL, String mimeType)
PostMessageToServiceWorkerClient(struct WebCore::ServiceWorkerClientIdentifier destination, struct WebCore::MessageWithMessagePorts message, WebCore::ServiceWorkerIdentifier source, String sourceOrigin)
- DidFailHeartBeatCheck(WebCore::ServiceWorkerIdentifier identifier);
+ DidFailHeartBeatCheck(WebCore::ServiceWorkerIdentifier identifier)
}
#endif // ENABLE(SERVICE_WORKER)
Modified: branches/safari-609-branch/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp (259507 => 259508)
--- branches/safari-609-branch/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp 2020-04-03 20:33:48 UTC (rev 259507)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp 2020-04-03 20:39:48 UTC (rev 259508)
@@ -337,19 +337,13 @@
callback(WTFMove(clientsData));
}
-void WebSWContextManagerConnection::claim(WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, CompletionHandler<void()>&& callback)
+void WebSWContextManagerConnection::claim(WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, CompletionHandler<void(ExceptionOr<void>&&)>&& callback)
{
- auto requestIdentifier = ++m_previousRequestIdentifier;
- m_claimRequests.add(requestIdentifier, WTFMove(callback));
- m_connectionToNetworkProcess->send(Messages::WebSWServerToContextConnection::Claim { requestIdentifier, serviceWorkerIdentifier }, 0);
+ m_connectionToNetworkProcess->sendWithAsyncReply(Messages::WebSWServerToContextConnection::Claim { serviceWorkerIdentifier }, [callback = WTFMove(callback)](auto&& result) mutable {
+ callback(result ? result->toException() : ExceptionOr<void> { });
+ });
}
-void WebSWContextManagerConnection::claimCompleted(uint64_t claimRequestIdentifier)
-{
- if (auto callback = m_claimRequests.take(claimRequestIdentifier))
- callback();
-}
-
void WebSWContextManagerConnection::close()
{
RELEASE_LOG(ServiceWorker, "Service worker process is requested to stop all service workers");
Modified: branches/safari-609-branch/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h (259507 => 259508)
--- branches/safari-609-branch/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h 2020-04-03 20:33:48 UTC (rev 259507)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h 2020-04-03 20:39:48 UTC (rev 259508)
@@ -76,7 +76,7 @@
void workerTerminated(WebCore::ServiceWorkerIdentifier) final;
void findClientByIdentifier(WebCore::ServiceWorkerIdentifier, WebCore::ServiceWorkerClientIdentifier, FindClientByIdentifierCallback&&) final;
void matchAll(WebCore::ServiceWorkerIdentifier, const WebCore::ServiceWorkerClientQueryOptions&, WebCore::ServiceWorkerClientsMatchAllCallback&&) final;
- void claim(WebCore::ServiceWorkerIdentifier, CompletionHandler<void()>&&) final;
+ void claim(WebCore::ServiceWorkerIdentifier, CompletionHandler<void(WebCore::ExceptionOr<void>&&)>&&) final;
void skipWaiting(WebCore::ServiceWorkerIdentifier, CompletionHandler<void()>&&) final;
void setScriptResource(WebCore::ServiceWorkerIdentifier, const URL&, const WebCore::ServiceWorkerContextData::ImportedScript&) final;
bool isThrottleable() const final;
@@ -96,7 +96,6 @@
void syncTerminateWorker(WebCore::ServiceWorkerIdentifier, Messages::WebSWContextManagerConnection::SyncTerminateWorkerDelayedReply&&);
void findClientByIdentifierCompleted(uint64_t requestIdentifier, Optional<WebCore::ServiceWorkerClientData>&&, bool hasSecurityError);
void matchAllCompleted(uint64_t matchAllRequestIdentifier, Vector<WebCore::ServiceWorkerClientData>&&);
- void claimCompleted(uint64_t claimRequestIdentifier);
void setUserAgent(String&& userAgent);
void close();
void setThrottleState(bool isThrottleable);
@@ -113,7 +112,6 @@
HashSet<std::unique_ptr<ServiceWorkerFrameLoaderClient>> m_loaders;
HashMap<uint64_t, FindClientByIdentifierCallback> m_findClientByIdentifierRequests;
HashMap<uint64_t, WebCore::ServiceWorkerClientsMatchAllCallback> m_matchAllRequests;
- HashMap<uint64_t, WTF::CompletionHandler<void()>> m_claimRequests;
uint64_t m_previousRequestIdentifier { 0 };
String m_userAgent;
bool m_isThrottleable { true };
Modified: branches/safari-609-branch/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in (259507 => 259508)
--- branches/safari-609-branch/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in 2020-04-03 20:33:48 UTC (rev 259507)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in 2020-04-03 20:39:48 UTC (rev 259508)
@@ -34,7 +34,6 @@
SyncTerminateWorker(WebCore::ServiceWorkerIdentifier identifier) -> () Synchronous
FindClientByIdentifierCompleted(uint64_t clientIdRequestIdentifier, Optional<WebCore::ServiceWorkerClientData> data, bool hasSecurityError)
MatchAllCompleted(uint64_t matchAllRequestIdentifier, Vector<WebCore::ServiceWorkerClientData> clientsData)
- ClaimCompleted(uint64_t claimRequestIdentifier)
SetUserAgent(String userAgent)
UpdatePreferencesStore(struct WebKit::WebPreferencesStore store)
Close()