WebKit Bugzilla
Attachment 371451 Details for
Bug 198584
: Allow WebKitTestRunner to terminate network process after it finishes service worker file operations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198584-20190605165721.patch (text/plain), 12.21 KB, created by
youenn fablet
on 2019-06-05 16:57:22 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2019-06-05 16:57:22 PDT
Size:
12.21 KB
patch
obsolete
>Subversion Revision: 246034 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 5fdf6506d63bd69f70b1d0ae4167626ac0034905..84dba0c6c749d8d9a9fd1839f088f193b117ab11 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,27 @@ >+2019-06-05 Youenn Fablet <youenn@apple.com> >+ >+ Allow WebKitTestRunner to terminate network process after it finishes service worker file operations >+ https://bugs.webkit.org/show_bug.cgi?id=198584 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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-03 Darin Adler <darin@apple.com> > > Finish cleanup of String::number for floating point >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 667f8d71f26e57044e3c73c6c6491c321b0562d6..a75f1a4a2b16b685c9adf3d2208a6d9110ee07bc 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,17 @@ >+2019-06-05 Youenn Fablet <youenn@apple.com> >+ >+ Allow WebKitTestRunner to terminate network process after it finishes service worker file operations >+ https://bugs.webkit.org/show_bug.cgi?id=198584 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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-04 Youenn Fablet <youenn@apple.com> > > Use an enumeration in UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo callback >diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp >index c596a58b9bd9efbf36b073f9031e9863fa79ff10..24995e8791b94f8884b578f971150882b6d0b114 100644 >--- a/Source/WebCore/testing/Internals.cpp >+++ b/Source/WebCore/testing/Internals.cpp >@@ -4796,6 +4796,19 @@ bool Internals::audioSessionActive() const > 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(); >diff --git a/Source/WebCore/testing/Internals.h b/Source/WebCore/testing/Internals.h >index 675c80acd175e3984cd4c5b6e463e57bdfc68f19..65ba06f24b33601767350d38a5c9ac5e211569f4 100644 >--- a/Source/WebCore/testing/Internals.h >+++ b/Source/WebCore/testing/Internals.h >@@ -718,6 +718,8 @@ public: > double preferredAudioBufferSize() const; > bool audioSessionActive() const; > >+ void storeRegistrationsOnDisk(DOMPromiseDeferred<void>&&); >+ > void clearCacheStorageMemoryRepresentation(DOMPromiseDeferred<void>&&); > void cacheStorageEngineRepresentation(DOMPromiseDeferred<IDLDOMString>&&); > void setResponseSizeWithPadding(FetchResponse&, uint64_t size); >diff --git a/Source/WebCore/testing/Internals.idl b/Source/WebCore/testing/Internals.idl >index 0af33753cd474812540e23a96f06a664f29ee677..34036d7d6e0a7c4ab8b5539f7bae7006c2dee96d 100644 >--- a/Source/WebCore/testing/Internals.idl >+++ b/Source/WebCore/testing/Internals.idl >@@ -692,6 +692,7 @@ enum CompositingPolicy { > boolean isAnyWorkletGlobalScopeAlive(); > > DOMString serviceWorkerClientIdentifier(Document document); >+ Promise<void> storeRegistrationsOnDisk(); > > Promise<void> clearCacheStorageMemoryRepresentation(); > Promise<DOMString> cacheStorageEngineRepresentation(); >diff --git a/Source/WebCore/workers/service/SWClientConnection.h b/Source/WebCore/workers/service/SWClientConnection.h >index 64f9e2362f4d82f2070bdacd669362f12d1287cf..251925be8ae6a675421dcfeaf5894a84c3b40449 100644 >--- a/Source/WebCore/workers/service/SWClientConnection.h >+++ b/Source/WebCore/workers/service/SWClientConnection.h >@@ -88,6 +88,8 @@ public: > virtual bool isThrottleable() const = 0; > virtual void updateThrottleState() = 0; > >+ virtual void storeRegistrationsOnDiskForTesting(CompletionHandler<void()>&& callback) { callback(); } >+ > protected: > WEBCORE_EXPORT SWClientConnection(); > >diff --git a/Source/WebCore/workers/service/server/RegistrationStore.cpp b/Source/WebCore/workers/service/server/RegistrationStore.cpp >index 442e62f9daa3ed0931ee7f3fbfab5eb86aec986c..bb2e14dd8252e01f984fe2127311149f9eca722b 100644 >--- a/Source/WebCore/workers/service/server/RegistrationStore.cpp >+++ b/Source/WebCore/workers/service/server/RegistrationStore.cpp >@@ -87,6 +87,11 @@ void RegistrationStore::flushChanges(WTF::CompletionHandler<void()>&& completion > void RegistrationStore::startSuspension(WTF::CompletionHandler<void()>&& completionHandler) > { > m_isSuspended = true; >+ closeDatabase(WTFMove(completionHandler)); >+} >+ >+void RegistrationStore::closeDatabase(CompletionHandler<void()>&& completionHandler) >+{ > m_database->close(WTFMove(completionHandler)); > } > >diff --git a/Source/WebCore/workers/service/server/RegistrationStore.h b/Source/WebCore/workers/service/server/RegistrationStore.h >index 8dbc319661875da1331d0398fa463feb4ffc5aa0..1dd5a8cd6fc1bb69772b612b7edfd2b51e03664d 100644 >--- a/Source/WebCore/workers/service/server/RegistrationStore.h >+++ b/Source/WebCore/workers/service/server/RegistrationStore.h >@@ -48,10 +48,11 @@ public: > 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 >diff --git a/Source/WebCore/workers/service/server/SWServer.cpp b/Source/WebCore/workers/service/server/SWServer.cpp >index 76541f6099dbf9c61491a94a3c82ad8e5ffcf1df..c762903cc93f8244dc9952e71ecc8797ad68d323 100644 >--- a/Source/WebCore/workers/service/server/SWServer.cpp >+++ b/Source/WebCore/workers/service/server/SWServer.cpp >@@ -878,6 +878,15 @@ void SWServer::Connection::whenRegistrationReady(uint64_t registrationReadyReque > 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) { >diff --git a/Source/WebCore/workers/service/server/SWServer.h b/Source/WebCore/workers/service/server/SWServer.h >index 67753881e986feed8d167e19b51959b6c8c9e895..3c97e8795899f5986def53dfe069e3108de5c46d 100644 >--- a/Source/WebCore/workers/service/server/SWServer.h >+++ b/Source/WebCore/workers/service/server/SWServer.h >@@ -101,6 +101,8 @@ public: > 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; >diff --git a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in >index 7c50e624a3181499e3a53f8b73fb18eca76b929f..ab2468e8ce3cb5c6ddfc828ce75bfd8c1f627ed7 100644 >--- a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in >+++ b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in >@@ -46,6 +46,7 @@ messages -> WebSWServerConnection { > SyncTerminateWorkerFromClient(WebCore::ServiceWorkerIdentifier workerIdentifier) -> () Synchronous > > SetThrottleState(bool isThrottleable) >+ StoreRegistrationsOnDisk() -> () Async > } > > #endif // ENABLE(SERVICE_WORKER) >diff --git a/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp b/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp >index d53d133d725e27a0732d527d3cd0ba6d7f67a605..579054505bbb6626942954408b11b21b04ac5053 100644 >--- a/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp >+++ b/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp >@@ -269,6 +269,12 @@ void WebSWClientConnection::updateThrottleState() > 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) >diff --git a/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h b/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h >index 1ee72844648b09eff6016c3161ebbc3e132909ba..6debd8aff170d548ca0b48373271c4efb4771ec1 100644 >--- a/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h >+++ b/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h >@@ -93,6 +93,7 @@ private: > 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&); > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 4608d0dc516d174929b6a152a068ce24ecbce5a7..ed57039a773c7500c43dd455fde5d8f042a273f6 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,12 @@ >+2019-06-05 Youenn Fablet <youenn@apple.com> >+ >+ Allow WebKitTestRunner to terminate network process after it finishes service worker file operations >+ https://bugs.webkit.org/show_bug.cgi?id=198584 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * http/wpt/service-workers/service-worker-networkprocess-crash.html: >+ > 2019-06-05 Youenn Fablet <youenn@apple.com> > > Layout test landed flaky in 245873 [ Release ] http/wpt/service-workers/service-worker-networkprocess-crash.html is a flaky failure >diff --git a/LayoutTests/http/wpt/service-workers/service-worker-networkprocess-crash.html b/LayoutTests/http/wpt/service-workers/service-worker-networkprocess-crash.html >index 9c292bb9c33cbcb9071814c36538b58735dfa3a4..c92b5b029212248e5944f2226688f620a499e116 100644 >--- a/LayoutTests/http/wpt/service-workers/service-worker-networkprocess-crash.html >+++ b/LayoutTests/http/wpt/service-workers/service-worker-networkprocess-crash.html >@@ -45,6 +45,9 @@ promise_test(async (test) => { > }, "Frame being controlled"); > > promise_test(async (test) => { >+ if (window.internals) >+ await internals.storeRegistrationsOnDisk(); >+ > if (window.testRunner && window.testRunner.terminateNetworkProcess) > testRunner.terminateNetworkProcess(); >
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
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198584
: 371451