Diff
Modified: trunk/LayoutTests/ChangeLog (246183 => 246184)
--- trunk/LayoutTests/ChangeLog 2019-06-07 00:30:09 UTC (rev 246183)
+++ trunk/LayoutTests/ChangeLog 2019-06-07 01:28:54 UTC (rev 246184)
@@ -1,3 +1,12 @@
+2019-06-06 Youenn Fablet <[email protected]>
+
+ Allow WebKitTestRunner to terminate network process after it finishes service worker file operations
+ https://bugs.webkit.org/show_bug.cgi?id=198584
+
+ Reviewed by Geoffrey Garen.
+
+ * http/wpt/service-workers/service-worker-networkprocess-crash.html:
+
2019-06-06 Commit Queue <[email protected]>
Unreviewed, rolling out r246165.
Modified: trunk/LayoutTests/http/wpt/service-workers/service-worker-networkprocess-crash.html (246183 => 246184)
--- trunk/LayoutTests/http/wpt/service-workers/service-worker-networkprocess-crash.html 2019-06-07 00:30:09 UTC (rev 246183)
+++ trunk/LayoutTests/http/wpt/service-workers/service-worker-networkprocess-crash.html 2019-06-07 01:28:54 UTC (rev 246184)
@@ -45,6 +45,9 @@
}, "Frame being controlled");
promise_test(async (test) => {
+ if (window.internals)
+ await internals.storeRegistrationsOnDisk();
+
if (window.testRunner && window.testRunner.terminateNetworkProcess)
testRunner.terminateNetworkProcess();
Modified: trunk/Source/WebCore/ChangeLog (246183 => 246184)
--- trunk/Source/WebCore/ChangeLog 2019-06-07 00:30:09 UTC (rev 246183)
+++ trunk/Source/WebCore/ChangeLog 2019-06-07 01:28:54 UTC (rev 246184)
@@ -1,3 +1,27 @@
+2019-06-06 Youenn Fablet <[email protected]>
+
+ Allow WebKitTestRunner to terminate network process after it finishes service worker file operations
+ https://bugs.webkit.org/show_bug.cgi?id=198584
+
+ Reviewed by Geoffrey Garen.
+
+ Add a promise-based internal API to store service worker registrations on disk.
+ Covered by updated test.
+
+ * testing/Internals.cpp:
+ (WebCore::Internals::storeRegistrationsOnDisk):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+ * workers/service/SWClientConnection.h:
+ (WebCore::SWClientConnection::storeRegistrationsOnDiskForTesting):
+ * workers/service/server/RegistrationStore.cpp:
+ (WebCore::RegistrationStore::startSuspension):
+ (WebCore::RegistrationStore::closeDatabase):
+ * workers/service/server/RegistrationStore.h:
+ * workers/service/server/SWServer.cpp:
+ (WebCore::SWServer::Connection::storeRegistrationsOnDisk):
+ * workers/service/server/SWServer.h:
+
2019-06-06 Brent Fulgham <[email protected]>
Avoid generating new XSLT-based document when already changing the document.
Modified: trunk/Source/WebCore/testing/Internals.cpp (246183 => 246184)
--- trunk/Source/WebCore/testing/Internals.cpp 2019-06-07 00:30:09 UTC (rev 246183)
+++ trunk/Source/WebCore/testing/Internals.cpp 2019-06-07 01:28:54 UTC (rev 246184)
@@ -4796,6 +4796,19 @@
return false;
}
+void Internals::storeRegistrationsOnDisk(DOMPromiseDeferred<void>&& promise)
+{
+#if ENABLE(SERVICE_WORKER)
+ if (!contextDocument())
+ return;
+
+ auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(contextDocument()->sessionID());
+ connection.storeRegistrationsOnDiskForTesting([promise = WTFMove(promise)]() mutable {
+ promise.resolve();
+ });
+#endif
+}
+
void Internals::clearCacheStorageMemoryRepresentation(DOMPromiseDeferred<void>&& promise)
{
auto* document = contextDocument();
Modified: trunk/Source/WebCore/testing/Internals.h (246183 => 246184)
--- trunk/Source/WebCore/testing/Internals.h 2019-06-07 00:30:09 UTC (rev 246183)
+++ trunk/Source/WebCore/testing/Internals.h 2019-06-07 01:28:54 UTC (rev 246184)
@@ -718,6 +718,8 @@
double preferredAudioBufferSize() const;
bool audioSessionActive() const;
+ void storeRegistrationsOnDisk(DOMPromiseDeferred<void>&&);
+
void clearCacheStorageMemoryRepresentation(DOMPromiseDeferred<void>&&);
void cacheStorageEngineRepresentation(DOMPromiseDeferred<IDLDOMString>&&);
void setResponseSizeWithPadding(FetchResponse&, uint64_t size);
Modified: trunk/Source/WebCore/testing/Internals.idl (246183 => 246184)
--- trunk/Source/WebCore/testing/Internals.idl 2019-06-07 00:30:09 UTC (rev 246183)
+++ trunk/Source/WebCore/testing/Internals.idl 2019-06-07 01:28:54 UTC (rev 246184)
@@ -692,6 +692,7 @@
boolean isAnyWorkletGlobalScopeAlive();
DOMString serviceWorkerClientIdentifier(Document document);
+ Promise<void> storeRegistrationsOnDisk();
Promise<void> clearCacheStorageMemoryRepresentation();
Promise<DOMString> cacheStorageEngineRepresentation();
Modified: trunk/Source/WebCore/workers/service/SWClientConnection.h (246183 => 246184)
--- trunk/Source/WebCore/workers/service/SWClientConnection.h 2019-06-07 00:30:09 UTC (rev 246183)
+++ trunk/Source/WebCore/workers/service/SWClientConnection.h 2019-06-07 01:28:54 UTC (rev 246184)
@@ -88,6 +88,8 @@
virtual bool isThrottleable() const = 0;
virtual void updateThrottleState() = 0;
+ virtual void storeRegistrationsOnDiskForTesting(CompletionHandler<void()>&& callback) { callback(); }
+
protected:
WEBCORE_EXPORT SWClientConnection();
Modified: trunk/Source/WebCore/workers/service/server/RegistrationStore.cpp (246183 => 246184)
--- trunk/Source/WebCore/workers/service/server/RegistrationStore.cpp 2019-06-07 00:30:09 UTC (rev 246183)
+++ trunk/Source/WebCore/workers/service/server/RegistrationStore.cpp 2019-06-07 01:28:54 UTC (rev 246184)
@@ -87,6 +87,11 @@
void RegistrationStore::startSuspension(WTF::CompletionHandler<void()>&& completionHandler)
{
m_isSuspended = true;
+ closeDatabase(WTFMove(completionHandler));
+}
+
+void RegistrationStore::closeDatabase(CompletionHandler<void()>&& completionHandler)
+{
m_database->close(WTFMove(completionHandler));
}
Modified: trunk/Source/WebCore/workers/service/server/RegistrationStore.h (246183 => 246184)
--- trunk/Source/WebCore/workers/service/server/RegistrationStore.h 2019-06-07 00:30:09 UTC (rev 246183)
+++ trunk/Source/WebCore/workers/service/server/RegistrationStore.h 2019-06-07 01:28:54 UTC (rev 246184)
@@ -48,10 +48,11 @@
explicit RegistrationStore(SWServer&, String&& databaseDirectory);
~RegistrationStore();
- void clearAll(WTF::CompletionHandler<void()>&&);
- void flushChanges(WTF::CompletionHandler<void()>&&);
+ void clearAll(CompletionHandler<void()>&&);
+ void flushChanges(CompletionHandler<void()>&&);
- void startSuspension(WTF::CompletionHandler<void()>&&);
+ void closeDatabase(CompletionHandler<void()>&&);
+ void startSuspension(CompletionHandler<void()>&&);
void endSuspension();
// Callbacks from the SWServer
Modified: trunk/Source/WebCore/workers/service/server/SWServer.cpp (246183 => 246184)
--- trunk/Source/WebCore/workers/service/server/SWServer.cpp 2019-06-07 00:30:09 UTC (rev 246183)
+++ trunk/Source/WebCore/workers/service/server/SWServer.cpp 2019-06-07 01:28:54 UTC (rev 246184)
@@ -878,6 +878,15 @@
m_registrationReadyRequests.append({ topOrigin, clientURL, registrationReadyRequestIdentifier });
}
+void SWServer::Connection::storeRegistrationsOnDisk(CompletionHandler<void()>&& callback)
+{
+ if (!m_server.m_registrationStore) {
+ callback();
+ return;
+ }
+ m_server.m_registrationStore->closeDatabase(WTFMove(callback));
+}
+
void SWServer::Connection::resolveRegistrationReadyRequests(SWServerRegistration& registration)
{
m_registrationReadyRequests.removeAllMatching([&](auto& request) {
Modified: trunk/Source/WebCore/workers/service/server/SWServer.h (246183 => 246184)
--- trunk/Source/WebCore/workers/service/server/SWServer.h 2019-06-07 00:30:09 UTC (rev 246183)
+++ trunk/Source/WebCore/workers/service/server/SWServer.h 2019-06-07 01:28:54 UTC (rev 246184)
@@ -101,6 +101,8 @@
WEBCORE_EXPORT void syncTerminateWorker(ServiceWorkerIdentifier);
WEBCORE_EXPORT void whenRegistrationReady(uint64_t registrationReadyRequestIdentifier, const SecurityOriginData& topOrigin, const URL& clientURL);
+ WEBCORE_EXPORT void storeRegistrationsOnDisk(CompletionHandler<void()>&&);
+
private:
// Messages to the client WebProcess
virtual void rejectJobInClient(ServiceWorkerJobIdentifier, const ExceptionData&) = 0;
Modified: trunk/Source/WebKit/ChangeLog (246183 => 246184)
--- trunk/Source/WebKit/ChangeLog 2019-06-07 00:30:09 UTC (rev 246183)
+++ trunk/Source/WebKit/ChangeLog 2019-06-07 01:28:54 UTC (rev 246184)
@@ -1,3 +1,17 @@
+2019-06-06 Youenn Fablet <[email protected]>
+
+ Allow WebKitTestRunner to terminate network process after it finishes service worker file operations
+ https://bugs.webkit.org/show_bug.cgi?id=198584
+
+ Reviewed by Geoffrey Garen.
+
+ Add IPC binding to new internal API.
+
+ * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in:
+ * WebProcess/Storage/WebSWClientConnection.cpp:
+ (WebKit::WebSWClientConnection::storeRegistrationsOnDiskForTesting):
+ * WebProcess/Storage/WebSWClientConnection.h:
+
2019-06-06 Commit Queue <[email protected]>
Unreviewed, rolling out r246165.
Modified: trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in (246183 => 246184)
--- trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in 2019-06-07 00:30:09 UTC (rev 246183)
+++ trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in 2019-06-07 01:28:54 UTC (rev 246184)
@@ -46,6 +46,7 @@
SyncTerminateWorkerFromClient(WebCore::ServiceWorkerIdentifier workerIdentifier) -> () Synchronous
SetThrottleState(bool isThrottleable)
+ StoreRegistrationsOnDisk() -> () Async
}
#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp (246183 => 246184)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp 2019-06-07 00:30:09 UTC (rev 246183)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp 2019-06-07 01:28:54 UTC (rev 246184)
@@ -269,6 +269,12 @@
ensureConnectionAndSend(Messages::WebSWServerConnection::SetThrottleState { m_isThrottleable });
}
+void WebSWClientConnection::storeRegistrationsOnDiskForTesting(CompletionHandler<void()>&& callback)
+{
+ initializeConnectionIfNeeded();
+ sendWithAsyncReply(Messages::WebSWServerConnection::StoreRegistrationsOnDisk { }, WTFMove(callback));
+}
+
} // namespace WebKit
#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h (246183 => 246184)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h 2019-06-07 00:30:09 UTC (rev 246183)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h 2019-06-07 01:28:54 UTC (rev 246184)
@@ -93,6 +93,7 @@
void didResolveRegistrationPromise(const WebCore::ServiceWorkerRegistrationKey&) final;
void updateThrottleState() final;
bool isThrottleable() const final { return m_isThrottleable; }
+ void storeRegistrationsOnDiskForTesting(CompletionHandler<void()>&&) final;
void scheduleStorageJob(const WebCore::ServiceWorkerJobData&);